![]() ![]() * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license You must choose an option before we can give you more advice.ġ) - New project -> FXML JavaFX Maven Archetype (Gluon) -> JavaFX-Version 17.0.2 -> FinishĢ) - Add to Source Package Java Class: Main It will automatically find JavaFX in the local Maven repository and add it to the module path when your application runs. There is a third option if you only use this application on your own machine, or if your clients also have Maven installed: Just run your application using the javafx-maven-plugin. The obvious disadvantage is that your release is a bit bigger because it also contains JavaFX. The second option doesn't need an installer because the dependencies are on a path relative to your application. You will have to provide an installer with your application that can create a shortcut to run your application with the correct command line arguments after the user selects their JavaFX installation. The first option has the disadvantage that you don't know where on the client's system JavaFX is located. Bundle the JavaFX modules with your release.Specify the location of the JavaFX modules on the client system as command line arguments when you run the JAR.If you want an executable JAR to work on your client's system, you must tell the JVM where on the client system to find the application's dependencies. ![]() A JAR that results fom a Maven build does not also automatically include its dependencies, JavaFX in this case. The result of a Maven build is usually an artifact that only contains the code that belongs to your Maven project. ![]() Let's take a step back and think about the problem. The thread got a little confusing so you may need to post some "latest versions" of your config files to avoid confusion, if you're still having problems. You need to make sure the main class is given to that plugin's configuration - do you have the plugin configured like this? Since you're using the maven JFX plugin, maybe it's not working correctly. the setup can be quite fussy.Īnyway sorry for the sidetrack, let's see if we can get your current setup working. I did try revisiting the straight OpenJDK method and had more luck this time around, but you definitely do have to pay close attention to the instructions at. If you're in a hurry you still may have better luck if you use the Azul FX JDK the "Badass Runtime Plugin" (), but like Stephan mentioned it's always better if you don't have such a dependency. Well you've made some progress with the generic Jar problem, but the NoClassDefFoundError: javafx/application/Application tells us that there's still a JavaFX specific problem and I'm thinking it's probably related to the JFX Maven plugin config. ![]() Java -jar C:\Users\acima\Documents\NetBeansProjects\mavenproject1\target\Įrror: Could not find or load main class Ĭaused by: : javafx/application/Application I was able to insert Main-Class into MANIFEST.MF by adding this code to POM.XML: In the jar itself, do you have a MANIFEST.MF file in the META-INF folder with something like this: Anyway, I'm not a Maven person (Gradle here) but you can check the jar file itself to see what it's doing. Or a JavaFX application class must extend Hamers wrote:That looks truncated. The main method syntax must be as public static void main(String args) Output Error: Main method not found in class, please define the main method as: The main method indicates the start of the application. The java error: main method not found in the file, please define the main method as: public static void main(string args) occurs if the main method not found in class or the main method is not accessible or the main method is invalid. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |