Quinn Severs
Quinn Severs

Reputation: 17

Netbeans Jar file with .java, not .class files

I'm trying to make a jar file through Netbeans, I can use the Clean & Build option and a new jar file will be made in my project directory. However I need to submit these jar files for homework assignments and they need to have the .java source files in them, not the .class files. My classmates generally use eclipse and have no problem, but I have not been able to find a solution in Netbeans.

I am using Netbeans 8.2 with Java 1.8.0_161.

Any help would be greatly appreciated!

Upvotes: 0

Views: 901

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347204

I just need to submit a jar file that will execute the program I just created that uses .java files instead of the .class files. The .class files in the jar are just jibberish to the grader.

Doesn't make sense. In order to execute the JAR, you need the .class files, that's what gets executed.

I would go back to your lecture and clarify what they mean

If you need to "also" include the .java files, then you can do the following:

Right click on the project node, select "Properties" from the popup menu

Properties popup

From the properties dialog, got to "Build | Packaging"

Properties Dialog

Change the "Exclude From JAR File" to remove the **/*.java from the available list of options. This should now include the .java files in the generated JAR

Upvotes: 1

Related Questions