Java: reconnect disconnected network share

412 views Asked by At

Windows XP on reboot doesn't automatically reconnect my network shares, Windows 7 only does it if the wifi connects fast enough, otherwise it fails and leaves them disconnected.

Usually when one of the two behaviors happen I just go to "computer resources" and double click on the network share drive and this automatically reconnects if the network connection is available.

Now how can a Java program try reconnecting the disconnected network shares it needs? Right now my program simply fails so I have to double click manually the network share's drive and restart my java program.

1

There are 1 answers

1
Ritzz081 On

To map a drive from a command prompt, and have it remain after a reboot, is to make it persistent.No need to write a java program.

[NET USE \computername\share -p]

Or, right click on My Computer, click map network drive, choose the location, and make sure "Reconnect at logon"

Hope this would help you