To make an executable JAR file from a Netbeans Maven project

Find the “pom.xml” file in the “Project Files” folder of your Netbeans project.

Paste in the following, right before the final project tag: </project>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.mycompany.MyMainGUI</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

And, in the pom.xml script above, change the main class to be the name of your main GUI class (what’s in bold).

Then Control-click on the project icon in Netbeans (the coffee cup icon for your project), and go Clean and Build.

You will find the executable jar file in the “target” folder of your Netbeans project (probably in your home folder, and a folder called Netbeans Projects).

The name will be something like:
MyIA-1.0-SNAPSHOT-jar-with-dependencies.jar

But you can change the name to whatever you want, just keep the .jar extension.

This file can be sent to anyone who has Java installed on their computer (most people), and they just double-click it to run it, like any other application file (.exe, or .app, etc.)