How to deploy JavaFX 14 JDK11 HSQLDB Java desktop application

2020-04-28 java eclipse javafx export hsqldb

Used IDE: Eclipse

After I Export the project as runnable jar with the first option (extract required libraries into jar)

The following happens (I've tried putting the JFX and HSQLDB libraries in both class and module path, same result)

While exporting:

9* Duplicate entry module-info.java

If I try to run directly:

Error: JavaFX runtime components are missing, and are required to run this application

If I run with following command, it works.

java --module-path ${PATH_TO_FX}/lib --add-modules javafx.controls,javafx.fxml -jar NAMEOFEXPORTEDFILE.jar

Problem 1: I`ve hardcoded the url of the database

private static final String dbPath = "/home/inductiomori/Desktop/inf202/bati-hsqldb/fuer202/";
private static final String url = "jdbc:hsqldb:file:" + dbPath;

How am I supposed to change these lines to make this work on other computers? (Im using linux, I want people from all platforms to be able to run it)

Problem 2: I need to have downloaded FX and have defined the PATH_TO_FX variable on the new computer if I use that command with VM arguments. How can I avoid that?

I`m new to deploying projects and I have absolutely no experience, so please explain nicely. Thank you.

Edit:

so I`ve checked this link out http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html#dpc_variables_url

and it says I can define the url like

 jdbc:hsqldb:file:${mydbpath}

but I still wonder if this is good practice and how I am supposed to set the variable up for the other computer automatically

Answers

Related