File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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.
I agree. Here's the link:
subject: J2EE classpath question
It's not a secret anymore!