Re: Accessing Configuration in Jars

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Nov 09 2004 - 21:59:03 EST

  • Next message: Michael Sacket: "Re: Accessing Configuration in Jars"

    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 - 21:59:08 EST