Results 1 to 13 of 13
  1. #1
    Mostafa_mech is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

    Default running the created jar file

    Hello Everyone

    I am in really in need for a quick solution for my problem.
    when I press compiles & run the program run perfectly on the netbeans, but when I double click the jar file created in the dist folder, nothing happens.

    The program is an application to connect to serial port to read data from a GPS.

    I am about to finish my project and still have no jar file!

    Please, any one have a solution for this tells me, as I am in need for this urgently.

    I uploaded the classes generated by the net beans as attachments.
    Attached Files Attached Files

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,956
    Rep Power
    19

    Default

    Run the jar file from the command line then tell us what error you get.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default

    nothing happens
    Enter a command prompt window, go to the folder with the jar file and enter the command:

    java -jar <YOURJARFILENAME>.jar

    Copy the whole of the command prompt window and paste it here.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,956
    Rep Power
    19

    Default

    Admit it, you have that post in your paste buffer...;)

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default

    Boy don't I wish. I bet I have 10 posts that I do over and over and over. I need a plugin for inserting code with a drop down list I can choose one of the standard replies from.

    Idea for a program to present a menu of titles that when clicked load a string into the clipboard
    Program to have icon in task bar
    menu titles and Strings to come from a properties file.

    Where is that student that was looking for a project?
    Last edited by Norm; 07-01-2010 at 04:56 PM. Reason: Idea struck

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,956
    Rep Power
    19

    Default

    That would be very popular in a lot of foums, that would!

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default

    OK. I'll give it a go.

    Here's a zip with a jar and an ini file.
    Give it a test run.
    Attached Files Attached Files
    Last edited by Norm; 07-01-2010 at 07:12 PM.

  8. #8
    Mostafa_mech is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

    Default

    Ok the output when I ran the jar by CMD was:

    C:\Users\mostafa\Desktop\Java\Image\dist>java -jar Image.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: Image/Hope
    at image.Main.main(Main.java:17)
    Caused by: java.lang.ClassNotFoundException: Image.Hope
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    ... 1 more
    Does this make sense ?


    Thank you for your help..

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default

    ClassNotFoundException: Image.Hope
    It looks like there is a mismatch between the manifest file in the jar file and the name of the class or the class file: Hope.class in the Image directory is missing.
    Open the jar file and take a look. Use any zip reading program to do that.
    Look in the manifest file for the entry: Main-Class: Image.Hope. That should be there.
    Then look in the jar file for the Hope.class file in the Image directory.
    That's probably missing.
    Go back to the IDE and try to create the jar file with the correct contents.

  10. #10
    Mostafa_mech is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

    Default

    Ok the output when I ran the jar by CMD was:

    C:\Users\mostafa\Desktop\Java\Image\dist>java -jar Image.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: Image/Hope
    at image.Main.main(Main.java:17)
    Caused by: java.lang.ClassNotFoundException: Image.Hope
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    ... 1 more
    Does this make sense ?


    Thank you for your help..

  11. #11
    Mostafa_mech is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

    Default

    I figured out what is wrong. There was mismatch in the package names in classes; one "image" and the other "Image", but why does not the compiler refuse this!!?

    anyway I am happy now, thank you very much for you time and effort with me.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default

    Is it the compiler or the IDE?

  13. #13
    Mostafa_mech is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 03-04-2010, 11:33 AM
  2. Replies: 1
    Last Post: 11-03-2009, 07:07 AM
  3. Problem executing .exe file created with C++ code
    By Singing Boyo in forum Advanced Java
    Replies: 45
    Last Post: 05-30-2009, 12:39 AM
  4. Replies: 2
    Last Post: 03-09-2009, 02:36 AM
  5. How to find file created date.....
    By roshithmca in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2008, 09:48 AM

Posting Permissions

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