Re: how to make an executable file from my class-files

Discussion in 'Java' started by Joseph Millar, Aug 7, 2003.

  1. On 7 Aug 2003 05:12:44 -0700, (Anne-Marte) wrote:

    > How do I (in details please) create an executable file from my *.class
    > files? I've tried to make a .jar file and a manifest, but without any
    > success at all...


    Creating an executable jar is very easy. Suppost you had a
    class called BigClass that you wanted to run as the main
    class. Simply creat a small file containing:

    Main-Class: BigClass

    and and call it anything you like (I'll call it BigClass.mf).
    Then simply create the jar like this:

    jar -cvmf BigClass.mf myjar.jar BigClass.class

    Then to execute it, do this:

    java -jar myjar.jar

    More details can be found here:

    http://java.sun.com/docs/books/tutorial/jar/

    --Joe
     
    Joseph Millar, Aug 7, 2003
    #1
    1. Advertising

  2. Joseph Millar

    Guest

    >> How do I (in details please) create an executable file from my *.class
    >> files? I've tried to make a .jar file and a manifest, but without any
    >> success at all...

    >
    >Creating an executable jar is very easy. Suppost you had a
    >class called BigClass that you wanted to run as the main
    >class. Simply creat a small file containing:
    >
    > Main-Class: BigClass
    >
    >and and call it anything you like (I'll call it BigClass.mf).
    >Then simply create the jar like this:
    >
    > jar -cvmf BigClass.mf myjar.jar BigClass.class
    >
    >Then to execute it, do this:
    >
    > java -jar myjar.jar
    >
    >More details can be found here:
    >
    > http://java.sun.com/docs/books/tutorial/jar/



    I would like to add a little reminder :

    (quoted from the tutorial) :

    'The text file must end with a new line or carriage return. The
    last line will not be parsed properly if it does not end with a
    new line or carriage return. '

    In other words, if your manifest-text-file does not end with
    a new line or carriage return, then your JAR-file will NOT execute !..

    This has once driven me nearly insane ! ;-)
     
    , Aug 7, 2003
    #2
    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. Replies:
    3
    Views:
    1,519
    Malte
    Mar 9, 2005
  2. kamal
    Replies:
    0
    Views:
    415
    kamal
    Mar 10, 2005
  3. Replies:
    15
    Views:
    510
    Dave Thompson
    Aug 21, 2006
  4. pratap
    Replies:
    20
    Views:
    790
    Flash Gordon
    Mar 7, 2007
  5. Jason Cavett
    Replies:
    8
    Views:
    657
    Sanjay
    May 16, 2007
Loading...

Share This Page