Problem running jar -- classpath error?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfie

    Problem running jar -- classpath error?

    I'm having a strange problem running a jar file I created using Eclipse.
    The application works correctly inside the IDE -- it compiles, runs,
    etc. So I exported it to a jar file and am trying to run it outside the
    IDE now. It requires an external jar file.

    I'm running it as:

    java -classpath path_to_externa l_jar/extJar.jar -jar myapp.jar

    When I do this, I receive a ClassDefNotFoun d exception for one
    of the classes in the external jar. A jar tf extJar.jar shows the
    class present in the jar file (which it had to be or it wouldn't have
    compiled inside Eclipse.)

    Anyone have an idea what's wrong? I've even placed the external
    jar in the ext directory for the JRE and it's still not found. I'm
    obviously missing something but I'm not sure what.

    TIA


  • dar7yl

    #2
    Re: Problem running jar -- classpath error?

    Did you set up the manifest correctly?

    regards,
    Dar7yl (the 7 is silent)

    "Wolfie" <bgbdwolf@gte.n et> wrote in message
    news:uDnwc.4547 9$w34.1738585@t wister.tampabay .rr.com...[color=blue]
    > I'm having a strange problem running a jar file I created using Eclipse.
    > The application works correctly inside the IDE -- it compiles, runs,
    > etc. So I exported it to a jar file and am trying to run it outside the
    > IDE now. It requires an external jar file.
    >
    > I'm running it as:
    >
    > java -classpath path_to_externa l_jar/extJar.jar -jar myapp.jar
    >
    > When I do this, I receive a ClassDefNotFoun d exception for one
    > of the classes in the external jar. A jar tf extJar.jar shows the
    > class present in the jar file (which it had to be or it wouldn't have
    > compiled inside Eclipse.)
    >
    > Anyone have an idea what's wrong? I've even placed the external
    > jar in the ext directory for the JRE and it's still not found. I'm
    > obviously missing something but I'm not sure what.
    >
    > TIA
    >
    >[/color]


    Comment

    • Raymond DeCampo

      #3
      Re: Problem running jar -- classpath error?

      Wolfie wrote:[color=blue]
      > I'm having a strange problem running a jar file I created using Eclipse.
      > The application works correctly inside the IDE -- it compiles, runs,
      > etc. So I exported it to a jar file and am trying to run it outside the
      > IDE now. It requires an external jar file.
      >
      > I'm running it as:
      >
      > java -classpath path_to_externa l_jar/extJar.jar -jar myapp.jar
      >
      > When I do this, I receive a ClassDefNotFoun d exception for one
      > of the classes in the external jar. A jar tf extJar.jar shows the
      > class present in the jar file (which it had to be or it wouldn't have
      > compiled inside Eclipse.)
      >
      > Anyone have an idea what's wrong? I've even placed the external
      > jar in the ext directory for the JRE and it's still not found. I'm
      > obviously missing something but I'm not sure what.
      >[/color]

      The -classpath option is ignored by the java process when the -jar
      option is used. You must specify the classpath in the manifest file of
      the jar being run.

      Ray

      Comment

      • Wolfie

        #4
        Re: Problem running jar -- classpath error?

        Raymond DeCampo wrote:
        [color=blue]
        > The -classpath option is ignored by the java process when the -jar
        > option is used. You must specify the classpath in the manifest file
        > of the jar being run.[/color]

        That doesn't make any sense. I have three jars -- an API to a
        database engine, a logging API, and the actual application jar.
        The location of the support jars may vary from platform to
        platform so I can't hardcode their location.

        As it turned out the problem was another java on the path
        (presumably Microsoft's) before the installed JSDK. When
        I specified the path to the proper java executable, the
        problems disappeared. I just love fun like that...


        Comment

        Working...