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 3 of 3

Thread: need help on jar files

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

    Default need help on jar files

    ]hi 2 every1

    i made a simple swing application with some database connectivity in it. d whole prog ws typed in notepad++ nd executed from command prompt. it ws executing perfectly. fyn...
    nw i copied d whole code in netbeans nd tried to build to main project so as to get my .jar file of my coding. .jar file ws created successfully, bt when i tried 2 run it, it ws nt executing properly.
    fr eg, i hd a button in my application that displays all records present in d database. it displayed all records when i executed wid command prompt, bt when .jar file ws excecuted, no response ws made.
    plz help me to get out of dis prob

    thanx in advance


  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: need help on jar files

    Check to make sure the manifest is correct. To do that, either open the jar in WinRAR or open it manually.

    To do this, go to Control Panel -> Folder Options -> View -> Uncheck "Hide Extensions for known file types". Then go to your jar, right click, rename, change the extension from .jar to .zip. You will get a confirmation, and click ok. Now you can open your jar.

    Do this regardless of how you opened it:
    Inside the jar should be a folder named "META-INF". Go into that folder, inside that folder should be a document called "MANIFEST.MF". Open that in Notepad. The Manifest should read something like:
    Manifest-Version: 1.0
    Created-By: 1.6.0_14 (Sun Microsystems Inc.)
    Class-Path:
    Main-Class: War2_0
    3 things to note here are:
    1) The "Main-Class:" variable should be the name of the class with the main in it (no extension).
    2) The "Class-Path:" variable referenses any external libraries you used. It is best to include your external libraries in the same location as your executable jar. That way the "Class-Path:" variable will just include the library names and not any paths.
    3) The blank line at the end of the MANIFEST. I dont know why it needs it, but it does.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: need help on jar files

    Cross posted at: need help on jar files - Java Forums

  4. The Following User Says Thank You to Norm For This Useful Post:

    Darryl.Burke (July 14th, 2010)

Similar Threads

  1. hlp files
    By vgenopoulos in forum Java Theory & Questions
    Replies: 1
    Last Post: July 9th, 2010, 09:11 AM
  2. jar files
    By bguy in forum Java Theory & Questions
    Replies: 2
    Last Post: November 23rd, 2009, 06:37 PM
  3. exe files
    By subhvi in forum Java Theory & Questions
    Replies: 17
    Last Post: September 3rd, 2009, 09:43 AM
  4. [SOLVED] Using 3rd Party JAR Files
    By oss_2008 in forum Java Theory & Questions
    Replies: 12
    Last Post: June 12th, 2009, 10:27 AM