For some of my projects I'm using JavaFX for the GUI, and prior to JavaFX being split as OpenJFX I didn't had any problems with it. Now I want to use the latest versions of both JDK and JavaFX, so because of this some changes had to be made.
While working in Eclipse, everything is running as it should, I added JavaFX as a library, but I have some problems when I try to create an exe file from the runnable jar using Launch4j. In Eclipse I'm using 2 VM arguments:
- --module-path "Path to the lib folder\" --add-modules javafx.controls,javafx.graphics,javafx.fxml
- this is for Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
- --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
- this is for cannot access class com.sun.glass.ui.Window (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to unnamed module
With the second argument I don't have any problems, as it doesn't require a path to a lib, but the first one does, and I can't simply use a static path (like: C:\MyAppName\lib) because the user may install the app where he wants to, and there will be the lib also. That being said, what can I use as a relative path, so Launch4j knows what to do? The lib folder is in the same location as the exe.
I tried the following but with no luck (I've added them in JVM options box):
- --module-path "%EXEDIR%\lib" --add-modules javafx.controls,javafx.graphics,javafx.fxml
- --module-path "./lib" --add-modules javafx.controls,javafx.graphics,javafx.fxml
- --module-path "\lib" --add-modules javafx.controls,javafx.graphics,javafx.fxml
The question maybe has some details that may not be related to what I need, but maybe someone else has the same problem, and I wanted to add them to maybe help them too when I get an answer.