0

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

  • Each module must be in a separate JAR, therefor a fat JAR (e.g. created via _Runnable JAR_ export) is not possible when using JPMS. – howlger Apr 28 '20 at 16:21
  • Thank you. Could you please elaborate? – BATIKAN BORA ORMANCI Apr 28 '20 at 22:01
  • Having a `module-info.java` file means using [JPMS](https://en.wikipedia.org/wiki/Java_Platform_Module_System) and then it is not possible to export your code with other dependencies into a single JAR (like the _Runnable JAR_ export does). So you can either not use JPMS (if JPMS is not required by some dependencies) or do a _JAR file_ export which leads to multiple JARs (your code in one JAR plus the dependencies as JARs). So, which way do you want to choose? – howlger Apr 29 '20 at 05:35

0 Answers0