<p>We are working with some legacy code that accesses a shared drive by the letter (f:\ for example). Using the UNC notation is not an option.  Our Java wrapper app will run as a service, and as the first step, I would like to map the drive explicitly in the code. Has anyone done this?</p>

I think the easiest way is to use the Runtime.getRuntime().exec() method and call the "net use" command.
For example:
```
```
try {
        // Execute a command without arguments
        String command = "C:\\Windows\\system32\\net.exe use F: \\\\server\\share /user:user password";
        Process child = Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    }
```
```