您好我正在尝试使用java打开bat文件但无法...我已经使用此代码
try {
// TODO add your handling code here:
Process proc = Runtime.getRuntime().exec("cmd /c start C:/Users/user/Documents/NetBeansProjects/Dissertation/biodwh/startBioDWH.bat");
} catch (IOException ex) {
Logger.getLogger(AdminMenu.class.getName()).log(Level.SEVERE, null, ex);
}
请帮忙。 cmd打开但生成这样的消息 无法找到或加载主类launch.launcher
答案 0 :(得分:0)
尝试替换
Process proc = Runtime.getRuntime().exec("cmd /c start C:/Users/user/Documents/NetBeansProjects/Dissertation/biodwh/startBioDWH.bat");
通过
Process proc = Runtime.getRuntime().exec("C:/Users/user/Documents/NetBeansProjects/Dissertation/biodwh/startBioDWH.bat");
我们打开文件,但我不确定这有助于打开bat文件
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + yourfilepath);