Pages - Menu

Monday 30 May 2011

Step by Step Guidance How to Create Jar File in Java...



Step :1 Create Any Java File

Step :2 Compile that java file. When you compile java source file it will be generate class file.

Step :3 Checkout that file by Executing it.

Step :4 Go to console and go to the full path where you create your java source file and class file

Step :5 Write a command "jar cvf jar_file _name *.class" on DOS prompt. jar_file_name will indicate the jar file name which you want to create.

Step :6 Write another command "jar xf jar_file name" without quote
When you performed this command at movement one folder will be create with named META-INF

Go to that Folder this folder contain one file called MANIFEST.MF

Open this file with notepad
write below statement in this file at 3d row
Main-Class: Main_class_name
where "Main_class_name” means your class name of your java source file. Save this file.

Step :7 copy MANIFEST.MF file and paste it where your java source file, java class file and jar file is located

Step:8 Go to the Console and set path of Jar file and Manifest is

Step:9 Write command like "jar cvfm jar_file_name MANIFEST.MF *.class"
jar_file_name means name of your jar file which is already created.


Note:
When you write Main-Class: main_class_name in MANIFEST.MF file at that time after the "Min-Class:" statement space is must be after that writedown your main class name

No comments:

Post a Comment