I have NFS installed for Windows 2008 but when I try to access C:/Windows/System32/mount.exe or umount.exe and execute it in Java, I get an IO Exception that the file cannot be found.
Runtime.getRuntime().exec("C:/Windows/System32/mount.exe <location> J:");
This also doesnt work if you were thinking it might:
Runtime.getRuntime().exec("cmd.exe /C call C:/Windows/System32/mount.exe <location> J:");
The file wont even register as existing through Java
if(new File("C:/Windows/System32/mount.exe").exists())
System.exit(0);
else
System.exit(-1);
This code will always exit -1
I have verified over and over again that the file does indeed exist and my command works. What is going on? How can I mount an NFS drive through Java for Windows?
java.io.IOException: Cannot run program "C:/Windows/System32/mount.exe": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at Data.SystemExecutor.exec(SystemExecutor.java:46)
at Data.SystemExecutor.exec(SystemExecutor.java:18)
at Mount.Mount.setMount(Mount.java:40)
at Mount.Mount.<init>(Mount.java:30)
at Main.Main.main(Main.java:94)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 6 more
I tried running CMD as Administrator too
This sounds like an issue with the bitness (i.e., running a 32-bit version of Java with a 64-bit version of SUA installed). C:\Windows\System32
is redirected for 32-bit apps to C:\Windows\SYSWOW64
. See this question.