0

I browsed some time on the internet now and can't figure out my problem.
I tried to export one of my IntelliJ projects to .jar and if I run the .jar in consol (java -jar name.jar)
it shows JavaFX runtime is missing but required. if I start my project in IntelliJ it works all fine.
IntelliJ Ultimate 2020.1.
Please be patient with me, it's my first own java project and my first fx application,
and the first time I try to ake a jar.

I put some Screenshots of my settings down bellow (links).
https://ibb.co/whC6gvG - Project Structur - Project
https://ibb.co/86VMkg6 - Project Structure Artifacts
https://ibb.co/dgM9F2G - Project Structure Libarys (Javafx)
https://ibb.co/RcgFNm9 - Running configuration
https://ibb.co/vkMsqcw - cmd output for trying to run and java -version

thanks for your time and efforts i do appreciate them very much.

kind regards Nasten1988

Nasten1988
  • 86
  • 8

1 Answers1

0

When running java applications via command line you need to add external libraries (like the JavaFX one) in your classpath(This is simply a directory where the app will look for all the dependencies).But when running in Intellij, it does all the work for you.

Please refer this post: How to open JavaFX .jar file with JDK 11?

arnabxm
  • 149
  • 7
  • ok ill tryed
    java - jar --module-path D:\Apps\JetBrains\Libarys\javafx-sdk-14.0.1\lib --add-modules javafx.controls,javafx.fxml KFZDatenbank.jar
    but he cant create a virtual machine
    – Nasten1988 Jun 21 '20 at 14:30
  • please refer my updated answer. Sorry about the inconvenience. – arnabxm Jun 21 '20 at 16:02
  • no need to apologize, I am grateful that you have the time to help me. So I put all the libraries and the jar in one folder? like all in folder "app". Or should I do not use the jar and go with the classes? – Nasten1988 Jun 21 '20 at 16:13
  • If you proceed to build a jar without the external libraries you need to add those external libraries while running the jar via command line. But if you choose to add dependencies with your jar, you can just run the jar file. Please refer the link of my post for detailed answer. – arnabxm Jun 21 '20 at 16:23
  • while building the artifact, add all available elements in the jar – arnabxm Jun 21 '20 at 16:26
  • Yes, it works thank you mate i could kiss your feet!. Now I'll try to add all the libraries to the build. Thanks again I thought I couldn't run this project I put so much effort in. – Nasten1988 Jun 21 '20 at 16:38