Step-by-step Creation of Executable Jar for Java

1. Start Command Prompt. 
2. Navigate to the folder that holds your class files: 
   C:\>cd\
   C:\>cd java-code
3. Set path to include JDK’s bin.
	For example:
		C:\java-code> SET PATH=%PATH%:c:\Program Files\Java\jdk1.5.0\bin
4. Compile your class(es): 
		C:\java-code> javac TestForm.java
		C:\java-code> javac Main.java
5. Create a manifest file: 
	C:\java-code> echo Main-Class: Main >manifest.txt
6. Create a jar file: 
	C:\java-code> jar cvfm welcome.jar manifest.txt Main.class TestForm.class
7. Test your welcome.jar: 
	C:\java-code> welcome.jar

And that’s it we’re done.

Advertisements