File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes loading properties file for a component. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "loading properties file for a component." Watch "loading properties file for a component." New topic
Author

loading properties file for a component.

Ritesh Srivastava
Greenhorn

Joined: Jul 06, 2005
Posts: 26
Hi,

I have created a jar file which is going to use a propeties file.
The jar file is placed in C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\myApplication\WEB-INF\lib

There is a class in the jar which is trying to load the properties file and then access its values.

I have put the properties file in WEB-INF\classes as well as the root of the folder which is later converted to a jar.

How can I load the properties file? I tried different ways like using Thread.currentThread().getContextClassLoader().getResourceAsStream and some other wasy.

Thanks,
Ritesh
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This page from the Tomcat documentation shows two ways:
http://wiki.apache.org/tomcat/HowTo#head-45c3314139cb900ddd43dde2ff671532e6e844bc


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: loading properties file for a component.
 
Similar Threads
Servlet 2.3 Specification contradiction ?
Best place for .properties file?
loading properties into the classpath
JBoss class loading and reading .properties files
ANT: update JAR file