![run a java jar file in linux class run a java jar file in linux class](https://code.visualstudio.com/assets/docs/java/java-project/exportjar.gif)
This is a well known Exception, when developing Java programs. The program exists with " Could not find the main class: helloworld.Main. The main messages is : ClassNotFoundException. If you try to run the Jar using " java -jar HelloWorld.jar", you will get some error messages. And it's also unusual for Java Developers. But it's somehow the source of many problems especially if you give the absolute path to your javafx-sdk !!!. Running the jar file as mentioned before is fine. $ javafx -cp HelloWorld.jar helloworld.Main $ export PATH=$HOME/.netbeans/6.5/javafx-sdk/bin:$PATH Helloworld.Main is the main class with the package name Using export or an absolute path to run the produced jar file (HelloWorld.jar). You will find a " javafx-sdk" folder in this location If you installed NetBeans plug-in as mentioned in my previous post in this Blog $cd /home/kas/NetBeansProjects/HelloWorld/dist (The indicated PATH is on my own computer, change as needed) " dist" has a jar file containing the compiled classesĮxecute the Jar file from the Command LineĬhange directory and go to " dist" inside "HelloWorld" project " build" has compiled classes of the project Two folder are added inside "NetBeansProject" (default projects folder) in "HelloWorld" folder, these are " dist" and " build"
![run a java jar file in linux class run a java jar file in linux class](https://user-images.githubusercontent.com/13142418/46298485-c04e6500-c5d1-11e8-96f3-01d84f9fe237.png)
Right click on the project -> Build Project Select "Standard Execution" in "Application Execution Model" (Default) Right click on your project -> Properties -> Run The package name is " helloworld" and when you build the project, the produced class will be " Main.class" The project is created and Main.fx is opened Select JavaFX -> JavaFX Script Application -> NextĮnter a name for your project in "Project Name", leave all other options -> Click on Finish We need a very simple JavaFX project (HelloWorld)
#Run a java jar file in linux class license
Please read carefully JavaFX license before packaging or distributing any files. If you have such kind of questions, this tutorial is for you. The question here, is it possible to deploy a "normal" jar file and use it as we usually do for jars (ie: java -jar fileName.jar) ? Deploying a JavaFX stand alone application as a jar file, in NetBeans is really straightforward.