0

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
zee ilyas
  • 11
  • 1
  • 4
  • What kind of object is `pb`? You must specify the path. This can be [relative](https://stackoverflow.com/questions/21060992/how-does-java-resolve-a-relative-path-in-new-file) or absolute. – flaxel Sep 21 '20 at 18:25

1 Answers1

1

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"));

Spectric
  • 30,714
  • 6
  • 20
  • 43
  • Try specifying the direct path then. You can see the direct math by Right Clicking and then selecting Properties. – Spectric Sep 21 '20 at 18:29
  • so i did that, now i don't know if it worked or not but i'm getting a new error now :java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.cnn" is null at DataBase.DBcontrol.creer_piece(DBcontrol.java:122) at pdr.FrontController.initialize(FrontController.java:160) – zee ilyas Sep 21 '20 at 22:12
  • @zeeilyas that has nothing to do with the code in your question (not in any obvious way, at least). Try to debug that problem by yourself and, in case, create a new question. – Federico klez Culloca Sep 22 '20 at 09:20