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(); } } } //
THE FOLLOWING IS THE ERROR:
Cannot run program "C:\Program": CreateProcess error=2, The system cannot findHere is the file specifiederror:
***>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? But this program runs notepad.exe and associated text files rather easily. So can it only run programs in Win32?