I write a very simple java program with two classes: Business and Main.
I want to create a jar such that if I email it to someone they can:
- run the program (i.e. run the jar)
- open the jar to view the source code.
- the code can run on mac or windows
I have been using IDEs for so long I have forgotten how to do this.
I am using netbeans 7.x
EDIT:
I found the following way on Netbeans:
properties > packaging > exclude from jar file :: delete **/*.java
But when I try to execute the jar using
java -jar mybusiness.jar
it says
no main manifest attribute, in mybusiness.jar
But note that my jar has a main class. Am I missing a manifest file?
You can export a JAR file that includes the source code using Netbeans:
It will create the jar file that includes the source code if it successfully compiles.