わかりましたので、しばらく調べてみましたが、プログラムの何が問題なのかわかりません。cmd.exe のようなプログラムを作成しようとしています。1 つのコマンドは、C:/Windows/System32 にある msconfig.exe を起動することになっています。しかし、それは私に java.io.IOException を与えます:
java.io.IOException: Cannot run program "C:/Windows/System32/msconfig.exe": CreateProcess error=2, The system cannot find the file specified
これが私のコードです:
public static void msconfig() {
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec("C:/Windows/System32/msconfig.exe");
InputStream in = process.getInputStream();
OutputStream out = process.getOutputStream();
InputStream err = process.getErrorStream();
} catch (IOException e) {
Console.printToConsole("Could not launch msconfig.exe");
e.printStackTrace();
} finally {
Console.printToConsole("Successfuly launched msconfig.exe");
}
}
編集: だから、アプリケーションを Eclipse でエクスポートしたところ、正常に動作するようになりました! 私を助けようとしてくれた皆さん、ありがとう:)