Hi all,
My jar-packaged application needs to have jndi properties. If I hardcode
them or use VM commandline arguments it works.
According to docs it should be possible to use a jndi.properties file
that is enclosed in the jar. Where in the jar should I put the
jndi.properties file? (or what exactly is the classpath in a jar?)
TIA
Joost
Christian Schlichtherle - 14 Jun 2005 17:22 GMT
Hi,
you can put it anywhere in the JAR and simply call
getClass().getResourceAsStream("/path") in your class to retrieve an input
stream. Note that if the string starts with a slash, "path" needs to be
relative to the root of your JAR. Otherwise, it's relative to the location
of the class file in the JAR.
Regards,
Christian
Volker Raum - 07 Jul 2005 06:24 GMT
> Hi all,
>
[quoted text clipped - 8 lines]
>
> Joost
If you simply want to use the jndi by calling
InitialContext ctx = new InitialContext() ;
you will have to put the jndi.properties directly in the top level of
the jar, in no subdirectory.
jndi.properties is looked for in the top level of the classpath.
hope this answeres your question.
Volker