I created a project in IntelliJ and built a jar file from it (the main class is specified). But when I tried to run the jar file using cmd I am getting this error: JavaFX runtime components are missing, and are required to run this application(in command prompt). How can I fix this issue? (I am new to this. Please try to explain as easy as possible.)
cmd command: java -jar filename.jar
In the end, what I want is to run my JavaFX application just by clicking a single icon. How can I do that??? Are there any other ways to run my application like any other application run, just by clicking one icon? I don't want to open IntelliJ every time to run my application. I used: OS: Windows 10 | IntelliJ IDEA 2020.2.3 | jdk 14.0.2 | jre 1.8.0_251 | javaFX 15
(By the way, I installed JavaFX 15 in another drive. Not in the same hard drive which contains OS)
you can try this:
right click on your project then select export after that select export as runnable jar file don't forget to select second choice you have to export it with used lib, this should be able to run your jar using cmd and try to load all modules, not just javafx.controls
--module-path "put_here_the_path" --add-modules=ALL-MODULE-PATH
Or
You can do this step it can help
File >> Project Structure >> Modules >> Dependency >> + (on left-side of window)
click the "+" sign to designate the directory where you have unpacked JavaFX's "lib" folder.
then:
Run >> Edit Configurations
to fix this error try to load all modules
--module-path "put_here_the_path" --add-modules=javafx.controls,javafx.fxml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With