英文:
Why am I getting file doesn't exist?
问题
我正尝试使用以下代码运行一个应用程序,使用acquiadevdesktop:
Process p1 = Runtime.getRuntime().exec("C:\\Program Files (x86)\\DevDesktop\\AcquiaDevDesktop\\AcquiaDevDesktop2.exe");
pb.start();
Desktop.getDesktop().open(new File("AcquiaDevDesktop2"));
} catch (IOException ex) {
Logger.getLogger(HConnexion.class.getName()).log(Level.SEVERE, null, ex);
}
但是我遇到了以下错误:
java.lang.IllegalArgumentException: 文件:AcquiaDevDesktop2 不存在。
at java.desktop/java.awt.Desktop.checkFileValidation(Desktop.java:367)
at java.desktop/java.awt.Desktop.open(Desktop.java:427)
at DataBase.HConnexion.run_wamp(HConnexion.java:88)
at DataBase.HConnexion.connectDb(HConnexion.java:35)
at DataBase.DBcontrol.creer_piece(DBcontrol.java:105)
at pdr.FrontController.initialize(FrontController.java:160)
....
我可以尝试什么来解决这个问题?
英文:
I am trying to run an app with acquiadevdesktop with this code:
Process p1 = Runtime.getRuntime().exec("C:\\Program Files (x86)\\DevDesktop\\AcquiaDevDesktop\\AcquiaDevDesktop2.exe");
pb.start();
Desktop.getDesktop().open(new File("AcquiaDevDesktop2"));
} catch (IOException ex) {
Logger.getLogger(HConnexion.class.getName()).log(Level.SEVERE, null, ex);
}
Yet I am getting this error:
java.lang.IllegalArgumentException: The file: AcquiaDevDesktop2 doesn't exist.
at java.desktop/java.awt.Desktop.checkFileValidation(Desktop.java:367)
at java.desktop/java.awt.Desktop.open(Desktop.java:427)
at DataBase.HConnexion.run_wamp(HConnexion.java:88)
at DataBase.HConnexion.connectDb(HConnexion.java:35)
at DataBase.DBcontrol.creer_piece(DBcontrol.java:105)
at pdr.FrontController.initialize(FrontController.java:160)
....
What can I try to fix it?
答案1
得分: 1
确保添加文件类型,因为new File()
无法假设文件类型。
例如,如果是文本文件,应为:new File("AcquiaDevDesktop2.txt"));
英文:
Make sure to add the filetype, because new File()
can't assume what type it is.
For example, if it's a text file, it should be: new File("AcquiaDevDesktop2.txt"));
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论