I need to open .jar files which requires Java and JavaFX. I have installed both Java (from Oracle website) and JavaFX (SDK from openjfx website). I have added environment variables by updating /etc/environment
file, and adding JAVAFX_HOME="path/to/JavaFX"
.
/etc/environment
file looks like:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk-12.0.2/bin"
JAVA_HOME="/usr/lib/jvm/jdk-12.0.2"
JAVAFX_HOME="/home/joshi/Documents/javafx-sdk-12.0.2/lib"
For now, I can get a .jar file running by executing:
java --module-path $JAVAFX_HOME --add-modules ALL-MODULE-PATH -jar myfile.jar
There are multiple .jar files, which makes executing above command pretty troublesome. Name of .jar files are pretty non-catchy and complex too.
I want to know if I can add JavaFX jmods to Java permanently. For example, when we execute in terminal java --list-modules
, it should include JavaFX mods in it too.
/usr/lib/jvm/jdk-12.0.2/jmods
. But even after rebooting, java --list-modules
doesn't include JavaFX mods. I have also ran sudo update-alternatives --config java
sudo update-alternatives --config javac
Any help is highly appreciated. I am on Kubuntu.
You can use environment variable: _JAVA_OPTIONS
.
All options specified in this variable will be appended to the JVM startup args.
export _JAVA_OPTIONS="--module-path=/path/to/JavaFX --add-modules=ALL-MODULE-PATH"