Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export JAR in Netbeans with source

How can I export a .jar file with source (.java) in NetBeans?

like image 753
Jakub Wulp Belis Avatar asked Apr 23 '13 17:04

Jakub Wulp Belis


2 Answers

As simple as:

      Right click your project  »  Properties  »  Build  »  Packaging

Verify that Exclude from Jar File filter does not include *.java files.
That's it!

Your generated jar will include source code.

Project Properties

like image 53
jpfreire Avatar answered Sep 22 '22 18:09

jpfreire


A JAR file is a Java Archive, and generally includes compiled .java files (classes) into a directory format based on packages.

Generally, you would want to provide your .java files (java source code) in a format other than a jar.

Netbeans provides the ability to export a Project from

File > Export Project > To ZIP.

This will export the netbeans project along with any source code.

By default, The jar file is generated when you build your project in Netbeans and can be found in your "dist" directory inside your netbeans project. The "Files" tab (Ctrl + 2) in netbeans shows you your project files. You can right click on the jar file and find it's exact location on your computer by selecting properties.

See this question for more information on exporting a jar from Netbeans: Export JAR with Netbeans

like image 38
Matt Jones Avatar answered Sep 20 '22 18:09

Matt Jones