DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Creating Jars

  1. #1
    Join Date
    Oct 2004

    Question Creating Jars

    Hi everyone,

    I have an application that i need to distribute as a jar but i have no idea how to create the jar archive as well as something called the manifest file. Basically i have only one class and the main is in that class itself. The path of the of the the file i want to archive is as follows:


    and the path of my of my jar.exe is as follows:


    Could someone also explain(in detail if possible) to me or direct me to an informative website that explains what the manifest file is all about and also how to write a manifest file.

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West

  2. #2
    Join Date
    Nov 2004
    At the bottom of this page:


    You will find something like this:
    To create a JAR file having a manifest with the appropriate Main-Class header, you can use the Jar tool's m flag as described in the Modifying a Manifest section. You would first prepare a text file consisting of single line with the Main-Class header and value. For example, if your application was the single-class HelloWorld application, the entry point would of course be the HelloWorld class, and your text file would have this line:
    Main-Class: HelloWorld
    Assuming your text file was in a file called mainClass, you could merge it into a JAR file's manifest with a command such as this:
    jar cmf mainClass app.jar HelloWorld.class
    With your JAR file prepared in this way, you can run the HelloWorld application from the command line:
    java -jar app.jar
    I just created a file called "mainClass", and typed the above, voila!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.