0

I have created a JavaFX application in order to register data on my personal computer (Windows 10) and I am looking for launching it by double clicking on its JAR.

thank you in advance for your help.

Vinz

Miss Chanandler Bong
  • 4,081
  • 10
  • 26
  • 36
Louis33
  • 1
  • 5
  • 1
    Possible duplicate of [Can't execute jar- file: "no main manifest attribute"](https://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute) – Johannes Kuhn Feb 24 '18 at 11:39
  • Thank you for the link Nevertheless, I tried the operations which are on this page but it has not worked. – Louis33 Feb 24 '18 at 15:36
  • What does "has not worked" mean - what actually happens? If you run the jar file from the command line, do you see any exceptions? – James_D Feb 24 '18 at 16:22

3 Answers3

2

well i had the same problem after i was taught to use JAVAFX a week ago we had to use command line but that led to an idea

java -jar --module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" --add-modules javafx.controls,javafx.fxml yourjarfile.jar

type above in notepad and save it as a batch file (.cmd) launch the batch file

or shall i say double click!!!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Good solution. Thx. It could be solved as: `java -jar --module-path %cd%\javafx-sdk-11.0.2\lib --add-modules javafx.controls,javafx.fxml yourjarfile.jar` – Imeksbank Feb 13 '20 at 15:42
0

I would suggest using a launcher. It would give you many options like minimum and maximum supported JRE versions, heap size, and error messages' alerts. Take a look at Launch4j.

Miss Chanandler Bong
  • 4,081
  • 10
  • 26
  • 36
  • does it work for javaFX? JavaFX is not part of the JDK anymore ( non JAVA FX program runs fine on double click without using the batch file i am suggesting) –  Jun 20 '19 at 18:08
0

This is all not the way it is done today. Just use jpackage, which comes with JDK 14, and build a real application or installer with it. Then you can not only double click to launch your application, you will also benefit from all the other goodies like icons, install/uninstall, desktop integration, ... Have a look here to see how it works: https://github.com/dlemmermann/JPackageScriptFX

mipa
  • 10,369
  • 2
  • 16
  • 35