我似乎无法弄清楚这一点?我想用参数执行 dec.exe
这是我的文件结构:
这是我在鼠标点击时使用的代码。
Process process = null;
try {
process = new ProcessBuilder("dec.exe",idir,odir).start();
} catch (IOException e2) { e2.printStackTrace(); }
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
String total = "";
try {
while ((line = br.readLine()) != null) {
total += line;
txtrAsdasda.setText(total);
}
}
} catch (IOException e1) { e1.printStackTrace(); }
我收到以下错误:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.lang.ProcessBuilder.start(Unknown Source)
at pw.ConverterUIApp$3.actionPerformed(ConverterUIApp.java:128)
...
和
java.io.IOException: Cannot run program "dec.exe": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)