Generate JAR File in Netbeans
Have you ever made an application in NetBeans and wanted to share it with your friends, but did not know how to put all the class files together in NetBeans? If so, this is the right tutorial for you!
Steps
- Open up NetBeans.
- Open Project Properties. Right click on the name of the project you want to generate a JAR file from, and select Properties from a drop down menu.
- Mark the Checkbox Compress JAR File. On your Properties window, look at the list of Categories on the left side. Go over to Build and under it should be Packaging, click on it. You should see Compress JAR File checkbox on the right, mark it.
- Confirm the Change. Press the OK button at the bottom right.
- Build your Project. There are several ways to it, but the easiest one is to press a button with an icon of a hammer next to the drop down menu for running configuration.
- Locate your JAR file. Most common one is in My Documents/NetBeansProjects, on Windows, and Home/NetBeansProjects folder, on Ubuntu (Linux). In case the folder isn't there, click on Help, select About and check under Userdir.
- Know How to Run It. Open up Command Prompt/Terminal or make a batch file that has this line included: java -jar "<name of jar file>".
Tips
- You can also check the README.txt file in Dist folder for more help about starting your JAR file.
- By running the project (button that has green play icon), you build the project too.