Error: Could not find or load main class in JavaFX jar file
Answered
I created an app using IntelliJ Ultimate.
It's a JavaFX app to store details and send bulk sms. Followed the help on creating artifacts https://www.jetbrains.com/help/idea/creating-running-and-packaging-your-first-java-application.html#run_app
But when I run the Jar file, it outputs that error.
Please what am i doing wrong?
This is my repo:
https://github.com/connelevalsam/Messaging-app/tree/version2.0
Please sign in to leave a comment.
Make sure you have specified the class in JavaFX artifact settings
Thanks for your reply.
I tried this now, deleted the old manifest file and .jar file and then Build and rRun.
Shows the same error.
Does it work when you launch it via Application Run/Debug Configuration? If you see this error only when running standalone jar issue is likely with the classpath: https://stackoverflow.com/a/18093929/2000323
I've uploaded a bit modified project to https://www.dropbox.com/s/euhx5blwo9lso47/Messaging-app.zip?dl=0 which runs fine for me:
Hello thanks.
I run a lot of Java/ golang programs with this IDE no issue.
Now trying to run a jar, no way, i don't know.
But there's a jar i did sometime ago with CLI and that runs.
What if i added classpath during artifacts creation.
Am gonna check what you sent. Thanks.
Hi !
Thanks for those precious informations. I've followed them all, they got me closer to the bunldeled app, but still struguling with a problem :
Java FX Packager: /path/to/workspace/parcelmanagergui/out/ParcelManagerGUI.jar (is a folder)
Why does intelliJ creates a folder - and then complains about it ? I tried to change the native bundle format but none of them seems to work. As well as output directory, name and type of the artefact...
Any idea ?
Thanks !
Max
What do you get this error? Can you show the full output and your JavaFX artifact configuration or a sample project?
For uploading you can use https://uploads.jetbrains.com or any file sharing service.
I try to build a standalone JavaFX application, here is the artifact configuration :
and the project can be found here https://framagit.org/artiscales/parcelmanagergui (it may not compile right tho as I need to get to work to deploy related projects on the forge - and it's been a while !)
Thanks !
Commented the unresolved code. Artifact build works:
Try to rename :jar from it's name.
Thanks a lot. I'm still struggling.
I reproduced the objects you have on the 'output layout' pane. Create a new archive and set manifest infos (Main Class : fr.ign.artiscales.pm.gui.App). It now give me the error :
Java FX Packager: Can't build artifact - fx:deploy is not available in this JDK
Followed what was here : https://www.jetbrains.com/help/idea/packaging-javafx-applications.html#troubleshoot with completing some environment variable, but I doubt that could be the solution.
Tried to put the path of the javaFX sdk lib in the Class Path of the created archive - no effect
Then put the javafx-sdk element from the Available Elements panel (I first tried to put every lib from the 'Available Elements' inside, that is mandatory if I want to bundle everthing inside right?) but no effect as well
Anyway thanks a lot for your time and reactivity !!
Cheers
Max
>Java FX Packager: Can't build artifact - fx:deploy is not available in this JDK
JavaFX packager has been removed in JDK 11+. Oracle has open issues to restore removed in java 11 packager:
https://bugs.openjdk.java.net/browse/JDK-8212780
https://openjdk.java.net/jeps/343
Please see also https://youtrack.jetbrains.com/issue/IDEA-200721 for details and some links to sample projects if you need to build JavaFX with 11+ JDK.