#Creating JavaFX runnable file with JPackage

1 messages · Page 1 of 1 (latest)

strong oyster
#

Hi, I'm trying to create some runnable standalone apps with JavaFX, and one of the tools I'm trying to use is JPackage.

I thought it might be something with my app, so I decided to try it out with the basic hello-world intellij javafx default program.

Script:

jpackage --type msi --app-version "1.0"--name "Demo App with JavaFX" --input . --dest . --main-jar .\demo.jar --main-class com.example.demo.HelloApplication --module-path "C:\Users\****\OneDrive\Documents\javafx-jmods-20.0.1" --add-modules javafx.controls,javafx.fxml --win-shortcut

I can get the installer to be created, the app to install, but not to get the actual javafx app to run. Does anyone have any experience with getting apps to run with JPackage or a similar packager to run?

Or is there a easier way of creating an executable jar from a JavaFX app?

mossy lindenBOT
#

<@&987246527741304832> please have a look, thanks.

mossy lindenBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

sharp bay
#

you get any errors?

strong oyster
#

I double-click the app, but nothing is displayed. It looks like the installer runs and shows up in task manager. I'm not sure what I am doing wrong.

sharp bay
#

nvm I used launch4j instead of jpackage

#

mb

#

but that should work

#

but that will not give an installer iirc

#

it just gives a wrapper for your .jar

#

but I dont really remember anymore, it was like half a year ago

vivid dome
#

and I think you can't use input and main-jar with modules

#

you need to specify in module path all the modules, including yours

#

and then in --modules specify the main module

strong oyster
#

@sharp bay I was able to get javafx running at long last in Launch4j.

A few issues that I ran into:

  1. out of date runtime so I had to manually specify path to JDK
  2. JavaFX runtime components missing, so I had to manually add jvm options

But this link helped me out:
https://stackoverflow.com/questions/64532992/unable-to-run-jar-file-outside-intellij

I didn't even know that a alternative existed. It should satisfy my need for a runnable file. Thanks!

vivid dome
#

@strong oyster did you try what i said ?

strong oyster
strong oyster
mossy lindenBOT
#

Closed the thread due to inactivity.

If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍