B4J Question How to run jar file? Error: JavaFX runtime components are missing

morosh

Member
hello:
I've jdk-11.0.1 installed and when I try to run a jar file (in a command window typing java -jar file.jar), I got:
Error: JavaFX runtime components are missing, and are required to run this application

what am I missing?
Thank you
 

Magma

Expert
Licensed User
Longtime User
hello:
I've jdk-11.0.1 installed and when I try to run a jar file (in a command window typing java -jar file.jar), I got:
Error: JavaFX runtime components are missing, and are required to run this application

what am I missing?
Thank you
One way it is what Erel said... just double click exe

...if you have setup ok the paths.. from cmd line you can run it like that
 
Upvote 0

morosh

Member
Thank you both:
@Erel: I tried "Project --> Build Standalone Package", the jar is generated but I still have:
Error: JavaFX runtime components are missing, and are required to run this application, in a command window.

but I noticed that there is 2 exe files in temp\build (92.5KB) and in temp\build\bin (266KB), both run well after double click.

@Magma: I tried:
"E:\install\dvd1\dev_soft\B4X\jdk-11.0.1\bin\javaw" --module-path "E:\install\dvd1\dev_soft\B4X\jdk-11.0.1\javafx\lib" -add-modules ALL-MODULE-PATH -jar ctrlgen.jar
I got :
Untitled 1.jpg
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Erel: I tried "Project --> Build Standalone Package", the jar is generated but I still have:
Error: JavaFX runtime components are missing, and are required to run this application, in a command window.

but I noticed that there is 2 exe files in temp\build (92.5KB) and in temp\build\bin (266KB), both run well after double click.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Thank you both:
@Erel: I tried "Project --> Build Standalone Package", the jar is generated but I still have:
Error: JavaFX runtime components are missing, and are required to run this application, in a command window.

but I noticed that there is 2 exe files in temp\build (92.5KB) and in temp\build\bin (266KB), both run well after double click.

@Magma: I tried:
"E:\install\dvd1\dev_soft\B4X\jdk-11.0.1\bin\javaw" --module-path "E:\install\dvd1\dev_soft\B4X\jdk-11.0.1\javafx\lib" -add-modules ALL-MODULE-PATH -jar ctrlgen.jar
I got :
View attachment 134764
First of all... happy for you "executed" your app...

2nd the message you got can be... anything... i think you must into the folder of the jar/app and run this command..

also you can run it from java.exe if you want to have some more information into cmd window

java [options] -jar <jarfile> [args...]

A right setup (running a jar from cmd) must have at System variables the variable "OpenJdkPath" + Also if your jar need some extra libs (jar libs) you must set them on parameters (have in mind that is more difficult sometimes to run a jar from cmd line... need to know what exactly need, simple apps will run easier)
 
Upvote 0

morosh

Member
Thanks both
finally it was a typo, I typed "-add-modules" instead of "--add-modules", a - was missing.
Now working with both java and javaw
 
Upvote 0
Top