Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Creating JAR file in eclipse HELP !

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Creating JAR file in eclipse HELP !

    Hi Guys,
    I am trying to create a simple jar file which prints current time on console and I want to convert this Jar into an exe file using Jsmoother. But when I try to run the jar file through command line I get error “Class not found”. I tried by creating runnable jar file but there is no success. Please guide me how can I create a Jar file which will runnable on all the machine that has JRE installed.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Creating JAR file in eclipse HELP !

    Hello Maheshkh, welcome to the Java Programming Forums.

    I have moved this thread to - Java IDEs

    Creating a JAR file in Eclipse is easy.

    In Eclipse, select File > Export > Java > Jar File

    Click Next

    Tick the correct Project on the left hand side and expand to tick the correct Package.
    With the Package selected, tick the .java files on the right hand side which you wish to be added to the JAR.

    Where it says 'Select the export destination'
    Browse to the desired destination and give the file a name, eg time.jar

    Make sure 'compress the contents of the JAR file' is ticked and click Next, then Next again.

    Make sure 'Generate the manifest file' and 'Seal the JAR' are selected.

    Under 'Select the class of the application entry point:' click Browse and select the main Class.

    Now click Finish.

    Your JAR file will now be in the destination folder selected earlier.

    You can run this by navigating to the directory in a command window and typing: java -jar time.jar

    Try these instructions and let me know what happens.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Creating JAR file in eclipse HELP !

    Good afternoon.
    Am a java beginner. I created my first GUI program using eclipse.Its running well in eclipse but when I export it as a jar file to desktop(i tried even the simple helloWorld), its not loading on double click.How can I ran this program in windows without command line?. I tried exporting it as a runnable Jar file it loading on double click but when closed the process "javaw.exe" is not unloading in task manager. pls advise.

  4. #4
    Member
    Join Date
    Sep 2011
    Posts
    32
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Creating JAR file in eclipse HELP !

    Quote Originally Posted by skahilu View Post
    Good afternoon.
    Am a java beginner. I created my first GUI program using eclipse.Its running well in eclipse but when I export it as a jar file to desktop(i tried even the simple helloWorld), its not loading on double click.How can I ran this program in windows without command line?. I tried exporting it as a runnable Jar file it loading on double click but when closed the process "javaw.exe" is not unloading in task manager. pls advise.
    I think the javaw.exe is not a default program to open jar file on your OS. Try to change the file association.

    java memory
    Last edited by namhm; December 4th, 2011 at 06:50 PM.

Similar Threads

  1. how to add adt(android plugin) to eclipse from zip file ???
    By mahdi in forum Android Development
    Replies: 2
    Last Post: July 9th, 2011, 02:32 PM
  2. Replies: 5
    Last Post: November 13th, 2010, 01:53 PM
  3. Problem in Creating Jar file
    By sikriyogesh in forum Member Introductions
    Replies: 0
    Last Post: November 20th, 2009, 02:12 AM
  4. Creating a class file
    By ipatch in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 8th, 2009, 07:19 PM
  5. WAR file creation in Eclipse JEE
    By katty in forum Java IDEs
    Replies: 5
    Last Post: May 21st, 2009, 09:45 AM

Tags for this Thread