How can I export a .jar
file with source (.java
) in NetBeans?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With