![]() |
|
[Java] NoClassDefFoundError: javafx/application/Application - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] NoClassDefFoundError: javafx/application/Application (/showthread.php?tid=5936480) |
NoClassDefFoundError: javafx/application/Application - Tenno - Feb 1, 2019 Hello, I'm having some trouble running my jar. It works perfectly fine in Intellij IDEA, but when running it from command line I get this error: Code Error: Could not find or load main class com.myapp.MainI have read that this might be an issue with Java 11. I'm currently running OpenJDK11. java -version returns this: Code openjdk version "11.0.2" 2019-01-15This is a Maven project. I have added these dependencies for JavaFX: Code <dependency>My VM options for Intellij are these: Code --module-path "C:\path\to\javafx\javafx-sdk-11.0.2\lib" --add-modules=javafx.controls,javafx.graphics,javafx.fxmlDoes anybody have any idea what might be causing this issue? Do I have to go back to Java 8 JDK? RE: NoClassDefFoundError: javafx/application/Application - BottomNotch - Feb 2, 2019 what command u running via command line? sure the full package is getting included? this is same pc? did u see this yet? - https://stackoverflow.com/questions/16868446/javafx-exception-in-thread-main-java-lang-noclassdeffounderror-javafx-applica he includes some extra packaging/dependencies in the maven shit in one answer RE: NoClassDefFoundError: javafx/application/Application - Tenno - Feb 2, 2019 (Feb 2, 2019 11:25 AM)BottomNotch Wrote: what command u running via command line? sure the full package is getting included? this is same pc? I run java -jar myapp.jar. By full package, do you mean all dependencies? And yes, this is on the same computer. I tried the different solutions in the link you provided, but unfortunately, it did not solve it. RE: NoClassDefFoundError: javafx/application/Application - NeXTSTEP - Feb 3, 2019 (Feb 2, 2019 03:39 PM)Tenno Wrote: I run java -jar myapp.jar. By full package, do you mean all dependencies? And yes, this is on the same computer. Yeah so you're going to want a "fat jar" in this case (maven doesn't auto pack in your dependencies unless you tell it to). I really don't like fat jar's however, so instead I would create a tiny launch script that include Code java -Djavafx.whatever,etc.blah.blah -jar myapp.jarRE: NoClassDefFoundError: javafx/application/Application - Tenno - Feb 3, 2019 (Feb 3, 2019 12:30 AM)NeXTSTEP Wrote: Yeah so you're going to want a "fat jar" in this case (maven doesn't auto pack in your dependencies unless you tell it to). I really don't like fat jar's however, so instead I would create a tiny launch script that include Yeah, I got it working by using the maven-assembly-plugin and running Code mvn clean compile assembly:singleFor your command to work, what do I need to give to the user? Do I need to install OpenJFX and have it in the same folder as the jar? I also have other dependencies, like JFoenix. This is the first application I've made that is actually going to be used by people, so I'm trying to figure things out :) |