Java プログラムから .exe ファイルを起動しようとしています。次のコードを使用しました。
System.out.println("Opening " + path);
Process exec;
exec = Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + path);//path is the path of the exe file which is passed as an argument from another java class
出力は次のとおりです。
C:\Program Files (x86)\C-Free 5\CppIDE.exeを開く
しかし、それは開いていません。
代わりに試してみると
String pat="C:\\Program Files (x86)\\C-Free 5\\CppIDE.exe";
Process exec;
exec = Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + pat);
プログラムが開かれます。
何が問題なのかわからない。