How to make an .exe and an .app from a JavaFX 11 application using Netbeans

Viewed 4033

I have a javaFx application developed with:

  • OpenJDK 11
  • NetbeansIDE 10
  • JavaFX 11

Following the javaFX 11 instructions (here) I have created a self contained app.

Unfortunately, to start the app a long command is required. Something like this:

dist/jlink/HelloFX/bin/java -m hellofx/org.openjfx.MainApp

This is not the best option for the end users.

My question is:

  • How can I create an .exe (Windows) and .app (macOS), easy to distribute and start?
  • How can I add an icon for the app (right now the app appears with the classic java cup icon)?

I was not able to find any updated directions for that.

Thank you.

1 Answers

Compile the executable JAR file, and then use a tool to convert it to EXE.

There are few ways of doing that:

Launch4j is one of them

Another option can be Jar2Exe

Related