wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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
 
Consider Paul's rocket mass heater.
 
subject: How to set the location of the property file in the class path
 
Similar Threads
How to read properties file?
Using PropertyPlaceholderConfigurer to read in external properties - not working
Including property file in the jar
error in opening zip file
location of a property file