Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging is missing in the Project Properties in Netbeans

I wanted to build a jar from a project I just finished. I searched on google how to build a jar with NetBeans and in every source it says that I have to click under "Build" in the Project Properties on Packaging. As you can see on the screenshot "Packaging" is missing and I wanted to know if I just forgot something to do and if you know I can get to it.

Thanks in Advance.

enter image description here

like image 680
Pythagorion Avatar asked Sep 06 '25 02:09

Pythagorion


1 Answers

Short answer:

Use Run > Clean and Build Project (or Shift+F11) to build the JAR file.

Longer Answer:

The options you see in the "Project Properties" menu will depend on how you created your Java project.

If you used File > New Project > Java with Ant > Java Application... then you will see the following options under Project Properties:

enter image description here

This shows you various settings to manage how the project is packaged. But Shift+F11 is how you can build the JAR. The output windows shows the following:

Building jar: C:\your\path\to\project\AntDemo\dist\AntDemo.jar

A lot of the NetBeans documentation that I have seen is fairly old, and it assumes you are using an Ant project (because that used to be the default project type).

If you used File > New Project > Java with Maven > Java Application... then you will see the following options under Project Properties:

enter image description here

This looks like your screenshot.

In this case, Maven is responsible for building the JAR - which is why the "Packaging" option is not visible in this case. If you want to customize how the JAR is built, you have to edit the related Maven pom.xml file that was created as part of your project.

But you can still use Shift+F11 to initiate the build. The output will be different - something like this:

--- maven-jar-plugin:2.4:jar (default-jar) @ MavenDemo ---
Building jar: C:\your\path\to\project\MavenDemo\target\MavenDemo-2.0.jar
like image 167
andrewJames Avatar answered Sep 07 '25 17:09

andrewJames