This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Reading properties file problem 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 » Java in General
Bookmark "Reading properties file problem" Watch "Reading properties file problem" New topic
Author

Reading properties file problem

Angus Rose
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
Dear All,
I'm up against one of those irritating classpath problems. Let me explain the scenario:

I have an application deployed as a jar file. This application reads a properties file when it fires up. This properties file needs to be placed in a different directory when deployed so that the administrator can edit the properties contained within it. I have tried several ways of reading this file including
InputStream l_isAttillaPropertiesInputStream = this.getClass().getClassLoader().getResourceAsStream("AttillaQ.properties");

Currently, the properties file sits in the same directory as the jar file containing the application and the directory is on the classpath. Alas, the InputStream object is still null, i.e. the classloader cannot find the properties file.

Please help me!!!

Angus
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Please do not post the same question in multiple forums.

See the JavaRanch FAQ: Carefully choose one forum.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Reading properties file problem
 
Similar Threads
Path to store Embedded Database files
Tomcat's default classpath??
Read File from jar file
finding properties outside jar files?
Reading properties file problem