public class test2 {
public static void main(String[] args) {
try {
// print a message
System.out.println("Executing VLC.exe");
Process process = Runtime.getRuntime().exec("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe");
// print another message
System.out.println("VLC should now open.");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Here is the error:
Cannot run program "C:\Program": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source) at
java.lang.Runtime.exec(Unknown Source) at
java.lang.Runtime.exec(Unknown Source) at
java.lang.Runtime.exec(Unknown Source) at test2.main(test2.java:21)
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) ... 5 more***
But this program runs notepad.exe and associated text files rather easily. So can it only run programs in Win32?
