jQuery in Action, 2nd edition*
The moose likes IDEs, Version Control and other tools and the fly likes How to add .properties file to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to add .properties file to servlet" Watch "How to add .properties file to servlet" New topic
Author

How to add .properties file to servlet

PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212

Hello , I want to work with log4J.properties file in servlets .

The resource bundle must be on the CLASSPATH for that running Servlet.

So for this do i need to set the properties file in Run Configurations -->Classpath tab or anywhere else ??



and also i kept my file in the lib directory of my web application.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You forgot to mention the IDE in question.

At any way, all you need is to place it in a folder which is (by default) covered by the application's classpath. In case of a webapplication it is usually the /WEB-INF/classes and /WEB-INF/lib and also the /appserver/lib (exact path depends on the appserver in question).

Do you understand the meaning of "classpath" at any way?
PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212
The IDE is Eclipse 3.1

Okay , Please tell me the difference between the server classpath and client side classpath ??

If i set any classpath on to the Eclipse IDE will this be a client side or to Server Side??

and whether it is required where should i need to add log4j.jar in my webapplication lib folder , or in server bin lib folder and also do i need to refer to this properties file in catilina.bat file if the server is Tomcat ??

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Your question makes no sense. There is no means of "server side" and "client side" when talking about the classpath.

Just put the file in the classpath of the running environment.
PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212
Hey Thanks ,
If my application is a ear , then where should i keep my log4j.jar file as EJB's must also refer to it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to add .properties file to servlet
 
Similar Threads
Path to locate properties file of log4j
.properties file
loading properties file within war
cannot load property file from WAR
Eclipse classpath question