Re: Accessing Configuration in Jars

From: Michael Sacket (msacke..ammastream.com)
Date: Tue Nov 09 2004 - 22:02:26 EST

  • Next message: Andrus Adamchik: "Re: Composite objects"

    Hi Andrus,

    I figured this out. As it turns out, the -classpath flag is ignored
    when using the -jar flag. Removing the -jar flag and explicitly
    referencing the main class works fine. I replied to this earlier, but
    after review, it looks like I replied to myself. Oops. Thanks for the
    help.

    Michael

    On Nov 9, 2004, at 8:59 PM, Andrus Adamchik wrote:

    >
    > On Nov 9, 2004, at 1:40 PM, Michael Sacket wrote:
    >
    >> Hello Everyone,
    >>
    >> I'm attempting to place my cayenne.xml configuration into my jar
    >> files, but cayenne is having trouble finding it. I'm running this on
    >> Mac OS X, so when I place the jar file in /Library/Java/Extensions,
    >> the configs are found; but, if I move the jar outside of this
    >> directory and add it to my classpath on the command line, it isn't
    >> found. I see references to the 'CLASSPATH' variable here and there
    >> is this the same as 'java.class.path'? Thanks for your help.
    >>
    >> Michael
    >
    > Hi Michael,
    >
    > Looks like this is a CLASSPATH problem. If you have any Java classes
    > in that same jar file in addition to cayenne.xml, a quick check to
    > confirm the problem would be to try this in the code:
    > Class.forName("com.xyz.MyClass").
    >
    >> but, if I move the jar outside of this directory and add it to my
    >> classpath on the command line, it isn't found.
    >
    > That's strange. Do you add the full jar path, (e.g. in tsh: setenv
    > CLASSPATH /some/dir/my.jar:$CLASSPATH)? This should work. If not,
    > could you post the full command line (and also a printout of "echo
    > $CLASSPATH").
    >
    >> I see references to the 'CLASSPATH' variable here and there is this
    >> the same as 'java.class.path'?
    >
    > Yes, in a sense. Inside the JVM "java.class.path" is the property that
    > shows what classpath was used on JVM startup.
    >
    > Andrus
    >



    This archive was generated by hypermail 2.0.0 : Tue Nov 09 2004 - 22:02:34 EST