Thursday, April 22, 2010

Create Faster Jar file in java

1. Create manifest file
      Manifest-Version: 1.0
      Main-Class: mypackage1.package.mainclsss
      Class-Path: log4j.jar mail.jar xcc.jar
2. copy all the class files with package structure  in a foler say name "code"
3. put manifest file as sibling to folder code
4. Create jar from inside code folder
    jar cvfm MyJarName.jar MANIFEST.MF *.*
5. Put all required resources including external jars in the same folder as MyJarName.jar
6. Run the jar using
   java -jar MyJarName.jar anyargument

No comments: