Enter your email address:

Delivered by FeedBurner


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Create JAR File
11-18-2011, 08:58 PM
Post: #1
How to Create JAR File
Creating Jar in Java

Creating a jar file is easy in three step process first create the necessary class files and gif files( if you want to add it to the jar).
Step1: Create the class files and put it in a folder.
Step2:Create MANIFEST.MF file.
That file should contain the main method then only it will be executed when you double click it.
ex:Create a new notepad file and save it as MANIFEST.MF and add necessary entry like this

Main-Class: yourclassname
Method: yourmethodname
Sub-Class: yoursubclassname ifany

It Must contain Main-class others are optional.And put it in same folder where class file resides.
Step3:In cmd prompt within class folder give the commands as given below

jar cvfm anynameyoulike.jar MANIFEST.mf *.class *.gif *.dat
Sample o/p you get like below
added manifest
adding: yourclassname.class(in = 4823) (out= 2690)(deflated 44%)
adding: 45.gif(in = 35514) (out= 34772)(deflated 2%)
adding: jamal.dat(in = 385177) (out= 141285)(deflated 63%)

To Check your jar is created correctly by giving following commands,In cmd prompt

java -jar anynameyoulike.jar

That it you created jar file To execute it by double clicking you need to have Jre any questions ask us.
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
Information create a war file using jsp code rajasri 3 753 08-20-2012 06:11 PM
Last Post: alexrabe
Sad create a file from form input in java,jsp rajasri 1 651 07-31-2012 08:22 PM
Last Post: leomoonwalker
Sad how to import a csv file values in to database using jsp rajasri 2 2,425 02-20-2012 12:17 PM
Last Post: rajesh2407
Photo Convert jar to exe file rajasri 3 2,053 02-12-2012 04:55 PM
Last Post: ionutcib
Sad how to delete a file using jsp rajasri 0 795 12-19-2011 06:02 PM
Last Post: rajasri
Music How to extract war file in java rajasri 0 7,456 12-14-2011 12:07 PM
Last Post: rajasri
Its My Birthday! Dynamic Chart In Jsp/Create chart in jsp Part-1 rajasri 0 1,776 12-12-2011 11:10 PM
Last Post: rajasri
Photo How to import a war file in to eclipse rajasri 0 3,544 12-12-2011 11:02 PM
Last Post: rajasri
Photo how to add .properties/.jar file to classpath in eclipse rajasri 0 3,193 12-12-2011 07:26 PM
Last Post: rajasri

Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Like Our Facebook Page