在我使用 ISO Writer 刻录 Cd 的程序中,由于这个链接,我的代码应该在写入后弹出 cd,因为 -e 命令行,它刻录到 cd 但写入后不弹出,我不知道是什么问题?
//Library that use to create iso file
File mkisofs = new File("lib/cdrtools/mkisofs.exe");
//The root of file that we want to write on DVD
File source = new File(new ProductUtil().getProductDir()+ "\\output\\Autorun");
//Destination that the iso file will be save on it.
File destination = source.getParentFile();
//Library that use to write iso file
File isoWriter = new File("lib/isowriter/ISOWriter.exe");
String command = mkisofs.getPath()+" -UDF -o \'"+destination.getAbsolutePath()+"\\cd.iso\' \'"+source.getAbsolutePath()+"\'";
Process createIso = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(createIso.getErrorStream()));
String line = "";
String all = "";
while((line = reader.readLine()) != null) {
all += line+"\r\n";
}
if(createIso.waitFor() != 0) {
JOptionPane.showMessageDialog(null, all,"Error on creating ISO file: ("+createIso.waitFor()+")",JOptionPane.ERROR_MESSAGE);
return null;
}
command = isoWriter.getPath()+" -s 16 -e \""+destination.getAbsolutePath()+"\\cd.iso\"";
System.out.println(command);
Process writeIso = Runtime.getRuntime().exec(command);
这是我以这种格式添加驱动器名称时遇到的错误:
command = isoWriter.getPath()+" f: -s 16 -e \""+destination.getAbsolutePath()+"\\cd.iso\"";