This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to set the location of the property file in the class path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to set the location of the property file in the class path" Watch "How to set the location of the property file in the class path" New topic
Author

How to set the location of the property file in the class path

Sat Nar
Ranch Hand

Joined: Oct 22, 2004
Posts: 83
Hi,
i need to read a property file.If i give the full path say "c:\example\test.properties" its working fine.But in the code i need to only mention the property file name and set the path of this property file in the class path.

say

Properties prop = new Properties(new FileInputStream("test.properties");

and the location c:\example should not be specified here.It should be automatically detected.I tried setting this in the classpath but still it cannot recognise the file location.Kindly help me out.
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
check this

http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html


Lack of will power has caused more failure than lack of intelligence or ability.
My Blog | Red5 Resources | Technology Update | Daily Technology Tips
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set the location of the property file in the class path
 
Similar Threads
error in opening zip file
Using PropertyPlaceholderConfigurer to read in external properties - not working
location of a property file
Including property file in the jar
How to read properties file?