I don't used to make jar file to often to execute my program. I used to make a bat file, and paste my java xyz.class command inside that batch file and run. What I do when I need to make a jar file? I just do the below steps when I need.
Lets say your main class name is ICFun
1) First of create a Manifest file called ICFun.MF, and inside the file paste below lines
2) Create a batch file, which will import the path of your jar file at first line, and second line will contain the jar creating command with required classes.
You can add the class using folder, for example, folder1/*.class folder2/classes etc.
3) Now your ICFun.jar file is ready. You can run it by clicking it, or from command line.
java -jar ICFun.jar
That's what I do for my java archive creating from my class files.
Lets say your main class name is ICFun
1) First of create a Manifest file called ICFun.MF, and inside the file paste below lines
Manifest-Version: 1.0
Main-Class: ICFun
Created-By: 1.2 (Sun Microsystems Inc.)
2) Create a batch file, which will import the path of your jar file at first line, and second line will contain the jar creating command with required classes.
path="C:\Java\jdk1.6.0\bin"
jar -cvfm ICFun.jar ICFun.MF *.class
You can add the class using folder, for example, folder1/*.class folder2/classes etc.
3) Now your ICFun.jar file is ready. You can run it by clicking it, or from command line.
java -jar ICFun.jar
That's what I do for my java archive creating from my class files.
Comments
How do I merge them into single file ICFun.jar?
I think i missed this part on this article. Thank you for noticing this.