The moose likes EJB and other Java EE Technologies and the fly likes J2EE classpath question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "J2EE classpath question" Watch "J2EE classpath question" New topic

J2EE classpath question

J Waldinger

Joined: Sep 05, 2003
Posts: 12
I have a Web app that is packaged in a WAR file. I am using a properties file which I need to be in the classpath in order for it to get loaded. I have tried putting it under /WEB-INF/conf and under /WEB_INF/lib, but neither one works - those directories don't seem to be in the classpath. How can I add them to the classpath?
I've tried putting the file under /WEB-INF/classes, and this works. However, I don't want it to be there because it gets overwritten every time I do a build.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
How about fixing the build script instead?

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
J Waldinger

Joined: Sep 05, 2003
Posts: 12
Well, true - but I'm not using ANT to do builds I'm using WSAD. There's various workarounds for this problem, but it just seemed wrong to me that /conf and /lib weren't in the classpath - and I don't know how to correct that.
Harjot Narula

Joined: Sep 22, 2003
Posts: 11
put the properties file in the java source package in webapp.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: J2EE classpath question
Similar Threads
How Load Props File Not In Classpath in WebApp Without Hardcoding Full Path?
Problem with Tomcat 5.5
Run time classpath
Where to put log4j.jar in Weblogic 6.1?
JAX-WS Handler