Results 1 to 4 of 4
  1. #1
    po0oker is offline Member
    Join Date
    Oct 2007
    Posts
    11
    Rep Power
    0

    Default creating jar file

    hi

    i would like to create an executable jar file that runs by double clicking ..

    could someone please explain it step by step


    thank you in advance

  2. #2
    po0oker is offline Member
    Join Date
    Oct 2007
    Posts
    11
    Rep Power
    0

    Default

    ok i have managed to create the jar file but i am getting an error message

    ""could not find the main class . program exit ""

    anyone can help !!

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Are you working on any IDE? Most of the IDE create a jar file of your project.

    How did you create that jar file? Seems to me that you don't have included manifest.mf or, that file is failed to link your main class
    Last edited by Eranga; 03-25-2008 at 06:44 AM. Reason: adding more...

  4. #4
    new_2_java is offline Member
    Join Date
    Feb 2008
    Posts
    60
    Rep Power
    0

    Default

    Here's what you need to do:

    1. You should have a Manifest.mf file, which will contain the following lines.

    I am using HelloWorld.java as example.

    Java Code:
    Main-Class: your.package.HelloWorld
    NOTE: Make sure you hit ENTER at the end of the line (Manifest.mf file).

    2. Next create your jar file, as follow:
    Java Code:
    >jar cmf Manifest.mf hello.jar *.*
    That's it. You can run it by double clicking on it and or as follow:

    Java Code:
    >java -jar hello.jar
    Last edited by new_2_java; 04-04-2008 at 08:53 PM.

Similar Threads

  1. Creating jar file
    By Heather in forum Advanced Java
    Replies: 4
    Last Post: 02-11-2009, 10:58 AM
  2. Problem creating a Post script file
    By krishnan.1000 in forum New To Java
    Replies: 0
    Last Post: 02-14-2008, 08:15 PM
  3. Creating a File object in Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-16-2008, 11:24 AM
  4. creating .ear file
    By psn in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 01-06-2008, 06:01 AM
  5. File creating date/time
    By bugger in forum New To Java
    Replies: 1
    Last Post: 11-11-2007, 08:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •