The IDE takes care of the environment setup when running the JavaFX
application. Running the same app from the command prompt, requires the user to
add the environment components to the java command by including the "-p" and
"-add--modules" switches. For instance java -p
"%JAVAFX_HOME%\lib;%OTHER_EXTERNAL%\lib" -add--module
java.xml.bind,java.activation,javafx.control,.... -jar
org\openjfx\${packagename}\jarfile.jar
Best of luck.
On Monday, October 5, 2020, 9:48:02 PM GMT+3:30, Gary Shute
<[email protected]> wrote:
To whom it may concern:
Running Apache NetBeans 12.3 in my GraphicsCore project folder, I did a clean
and build on the project, and then ran its test.GraphicsTest program directly in
NetBeans. It ran with no errors.
But then I executed the following commands:
$ cd dist
$ ls
GraphicsCore.jar lib README.TXT
$ java -jar GraphicsCore.jar
Error: JavaFX runtime components are missing, and are required to run this
application
Although there was an error, the following commands show the JavaFX libraries
are
present and properly referenced in GraphicsCore.jar.
$ ls lib
javafx.base.jar javafx.fxml.jar javafx.media.jar javafx-swt.jar
javafx.controls.jar javafx.graphics.jar javafx.swing.jar javafx.web.jar
$ unzip -c GraphicsCore.jar META-INF/MANIFEST.MF
Archive: GraphicsCore.jar
extracting: META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.10.4
Created-By: 13.0.1+10-MTS (Azul Systems, Inc.)
Class-Path: lib/javafx.base.jar lib/javafx.controls.jar lib/javafx.fxm
l.jar lib/javafx.graphics.jar lib/javafx.media.jar lib/javafx.swing.j
ar lib/javafx.web.jar lib/javafx-swt.jar
Main-Class: test.GraphicsTest
So why the error in the java -jar command when there are no problems running
directly in NetBeans?
Here is the Java platform on which I ran the above commands.
$ java --version
openjdk 13.0.1 2019-10-15
OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS)
OpenJDK 64-Bit Server VM Zulu13.28+11-CA (build 13.0.1+10-MTS, mixed mode,
sharing)
I was using the Gluon JavaFX 15 runtime, JavaFX Linux SDK downloaded from
https://gluonhq.com/products/javafx/.
For system information, I ran the following linux commands on a System76 Darter
Pro Laptop, version darp6.
$ uname --machine
x86_64
$ uname --operating-system
GNU/Linux
$ uname --kernel-name
Linux
$ uname --kernel-release
5.4.0-48-generic
$ uname --kernel-version
#52~18.04.1-Ubuntu SMP Thu Sep 10 12:50:22 UTC 2020
Gary Shute