executing a jar

Discussion in 'Java' started by Lloyd Harlow Yap via JavaKB.com, Apr 14, 2005.

  1. Lloyd Harlow Yap via JavaKB.com, Apr 14, 2005
    #1
    1. Advertising

  2. Lloyd Harlow Yap via JavaKB.com

    T. Guest

    Lloyd Harlow Yap via JavaKB.com wrote:
    > how to make a executable jar files
    >


    I'd Google on Manifest-files. You have to create a jar (with the
    commandline jar tool that is included in the JDK) that contains your
    classfiles (in directories that match the packages) and a directory
    MANIFEST. That dir contains the manifest-file (google!) with the
    classpath and the main class.


    T.
    T., Apr 14, 2005
    #2
    1. Advertising

  3. Thomas Kellerer, Apr 14, 2005
    #3
  4. Lloyd Harlow Yap via JavaKB.com

    Malte Guest

    Lloyd Harlow Yap via JavaKB.com wrote:
    > how to make a executable jar files
    >


    If you do not have a tool, this will work (assumes *ix terminal). On
    Windows you could probably right mouse click on something in the filemanger:

    1. jar cvf myjar.jar myclass.class

    2. jar -xf myjar.jar

    3. cp META-INF/MANIFEST.MF .

    4. vi MANIFEST.MF

    5. add this line

    Main-Class: mypackage.Class1

    or whatever class in the package has the main method

    5. jar -cvmf MANIFEST.MF myjar.jar myclass.class

    java -jar myjar.jar
    Malte, Apr 14, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    552
    Arnold Peters
    Jan 5, 2005
  2. Dotty
    Replies:
    0
    Views:
    318
    Dotty
    Mar 7, 2005
  3. muttley
    Replies:
    0
    Views:
    2,688
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,722
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    637
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page