Page 1 of 2 12 LastLast
Results 1 to 20 of 26
  1. #1
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Exclamation Doesn't anyone here know how to help? I feel like I wanna hang myself

    I have had this problem for a year or so and I have spent so long trying to fix it I feel like I am going to fucking cry.

    I have the latest java and JDK. I can not run any .jar files. I can play stuff that uses java through my browser but cannot run a program off my hard drive. I am using vista.

    Let me explain it in a simple form:

    1. Father downloaded new java I think and maybe something else like windows update.
    2. When I try to run my .jar files it says it doesnt know what to open it with.
    3. Ages trying to fix it.
    4. .jar files open a black command prompt box with text for a split second then it closes instantly.
    5. uninstalled all my java staff again.
    6. Reinstalled the newest Java and JDK.
    7. See step 4.

  2. #2
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Post

    Follow these steps and let me know what it says now:

    1. Goto to bin directory of jdk.
    2. run this command:
    java -jar c:\pathofthefile\nameofthefile.jar

    3. It should run ur jar file

    Lets see what do you get now

  3. #3
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    Thanks a lot please explain further!

    I dont want to mess it up!

  4. #4
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    Please I didnt understand your post or how to do what you said

  5. #5
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Default

    Quote Originally Posted by I Want To Kill Java View Post
    Thanks a lot please explain further!
    1. Go to java installation directory, e.g c:\program files\java\jdk.......
    2. Go to bin directory.
    3. type java -jar c:\pathofthefile\nameofthefile.jar
    basically, you are asking java to execute the specified jar file. java is the service that will execute your jar file. -jar is the option which tells java that target is a jar file. c:\pathofthefile\nameofthefile.jar is your jar file which you want to run.

    That's it !!

  6. #6
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    Thanks but where do I type that stuff

  7. #7
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Default

    Quote Originally Posted by I Want To Kill Java View Post
    Thanks but where do I type that stuff
    Oops :( I am sorry.

    Got to command line for doing this.

  8. #8
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    is that like command prompt?

  9. #9
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Default

    Quote Originally Posted by I Want To Kill Java View Post
    is that like command prompt?
    Exactly,
    In java commumity command prompt is known as command line.

  10. #10
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    ok im going to try that again

  11. #11
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    wait, if im using command prompt why do I have to go to my JDK bin.

  12. #12
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Default

    Quote Originally Posted by I Want To Kill Java View Post
    wait, if im using command prompt why do I have to go to my JDK bin.
    because i don't know whether you have set your java_home or not.
    If your java_home is set then you don't need to go to jdk bin :)

  13. #13
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    java_home?

    And I run my command prompt from the start menu. Is that ok?!

  14. #14
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Never hear of java_home, however it is possible to add the java path
    to "path".

    I'll provide images...


    EDIT:
    You do not need to worry about this if
    java -version
    prints your installed version of java if typed in the command prompt.

    And yes, you run the command prompt from the start menu,
    or you select Run in the start menu and type cmd.
    Also you can type the command
    java -jar c:\pathofthefile\nameofthefile.jar
    their (from Run).
    Last edited by Hibernate; 12-29-2010 at 03:39 AM.

  15. #15
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    This should only be done if
    java -version
    did not print your installed version of Java.


    http://post.dyndns.org/image2-00.png
    http://post.dyndns.org/image2-01.png
    http://post.dyndns.org/image2-02.png
    http://post.dyndns.org/image2-03.png
    http://post.dyndns.org/image2-04.png

    Now you append (add) the the folder you installed Java to:

    http://post.dyndns.org/image2-05.png

    Then you click 'OK' on all opened windows.

  16. #16
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    when I do java -version it says my JRE version. But how does this help fix my cannot find main path I now have?>

  17. #17
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    Important bump

  18. #18
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    "Main path", I most have missed that.
    I'll reread the thread I see if a can figure out what you mean with main path and why it is not found.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  19. #19
    Join Date
    Dec 2010
    Posts
    40
    Rep Power
    0

    Default

    posted a screen of the main path error

  20. #20
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Can you extract (unzip) the jar file (using 7-zip, WinZip or whatever)
    and try to run your main class.

    Does there exist a manifest file, by standard named
    META-INF/MANIFEST.MF

    If does there exist a line beginning with "Main-Class: " and does it say
    Main-Class: FULLY_QUALIFIED_MAIN_CLASS_NAME

    Create a manifest file META-INF/MANIFEST.MF
    Fill it this data:
    Java Code:
    Manifest-Version: FILL_IN
    Package-Version: FILL_IN
    Product-Name: FILL_IN
    Package-Vendor: FILL_IN
    Created-By: FILL_IN
    Main-Class: FILL_IN
    Class-Path: WHITESPACE_SEPARATED_JAR_FILES
    And rebuild your jar file:
    cd PATH_WITH_FILES
    jar cfm META-INF/MANIFEST.MF **
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

Page 1 of 2 12 LastLast

Similar Threads

  1. What type of hang? and how to fix?
    By joshbrigade in forum New To Java
    Replies: 2
    Last Post: 11-06-2009, 11:40 PM
  2. Read XML from Internet Hang!
    By yupingliew in forum Networking
    Replies: 0
    Last Post: 10-22-2009, 06:56 AM
  3. Applet hang
    By Worlock in forum New To Java
    Replies: 2
    Last Post: 08-10-2009, 07:43 AM
  4. just wanna ask about images...
    By ashton in forum New To Java
    Replies: 11
    Last Post: 01-21-2009, 01:16 PM
  5. Web application hang without comm.jar
    By chankokchern in forum Java Applets
    Replies: 0
    Last Post: 12-16-2008, 01:38 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
  •