Labels

Tuesday, April 26, 2011

Thursday, April 21, 2011

Creating An Executable Jar File In Java

1 Create a java file.
२ compile it
३ Create a text file
which must contain the following code:
Manifest-version:१.०
Main-class:ClassName
note :The ClassName must be your class in which the main method is present for the application to start।
save the above file with the name manifest.MF or manifest.MFT
४ Create a jar file on command prompt as below
c:\your folder path>jar cvfm YourJarFileName manifest.MF *
c:\your folder path>jar cvfm YourJarFileName *.class
५ you will see the excutable jar file inside your folder.

Another way:::::
c:\programfiles\java\bin> jar cvf jarname.jar [classes/*/*.class/*]

To create a jar in which a module, submodules or some strucure is there we should go to root directory and then execute the jar command as

C:\Project\ABCProject\WEB-INF\classes>"C:\program files\bin\jar.exe" cvf jarname.jar [*/.class*.class]

YOu can find the class in jar as it is in the module directory.
To execute the stucture and jar should be in the dirctory structure as it is in the