Jar files execution failure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stack
    New Member
    • Sep 2007
    • 40

    #1

    Jar files execution failure

    I create jar files like that:
    Code:
    jar -cvmf manifest.txt app1.jar *.class
    I run them like that:
    Code:
    java -jar app1.jar
    Ok so far. My program is up and running.

    When I try to run the same jar files with double click ( in Win XP I associate them with java.exe) I get an error, Exception in thread main...no class found.

    What am I doing wrong?

    Thanks
    stack
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Originally posted by stack
    I create jar files like that:
    Code:
    jar -cvmf manifest.txt app1.jar *.class
    I run them like that:
    Code:
    java -jar app1.jar
    Ok so far. My program is up and running.

    When I try to run the same jar files with double click ( in Win XP I associate them with java.exe) I get an error, Exception in thread main...no class found.

    What am I doing wrong?

    Thanks
    stack
    Probably Windows isn't adding the "-jar" argument and therefore it can't find any of your classes - especially not the class containing the main method.

    To set it that way, open the place, where you associated JAR files with java.exe and click on "More" (or whatever the button may be called). If there's an Operation called "open", edit that, otherwise create a new one called "open". It should have the following value:
    Code:
    "C:\Program Files\Java\jre1.6.0_02\bin\java.exe" -jar "%1" %*
    Of course, you'll have to change the Path according to where java.exe lies.

    Greetings,
    Nepomuk

    Comment

    • stack
      New Member
      • Sep 2007
      • 40

      #3
      Originally posted by nepomuk
      Probably Windows isn't adding the "-jar" argument and therefore it can't find any of your classes - especially not the class containing the main method.

      To set it that way, open the place, where you associated JAR files with java.exe and click on "More" (or whatever the button may be called). If there's an Operation called "open", edit that, otherwise create a new one called "open". It should have the following value:
      Code:
      "C:\Program Files\Java\jre1.6.0_02\bin\java.exe" -jar "%1" %*
      Of course, you'll have to change the Path according to where java.exe lies.

      Greetings,
      Nepomuk
      I don't know if you can do that with XP and if you can, I don't know how it's done.
      My only option when I associate files is to choose from a list of programs but I cannot set a path.
      Do you know where I can set this path with win XP?

      Thank you for you reply,
      stack

      Comment

      • stack
        New Member
        • Sep 2007
        • 40

        #4
        Ok, problem solved.

        Thanks

        Comment

        Working...