Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / July 2005

Tip: Looking for answers? Try searching our database.

Where in the jar should I put the jndi.properties file?

Thread view: 
Joost Kraaijeveld - 09 May 2005 14:39 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.