I have the file which is using the above code and the properties file in the same package. But then the properties are not loaded. can someone suggest me a solution
Joined: Oct 20, 2004
Before answering, make sure that next time you put the code in "code" tags.
You need to have the properties file in the class path. If it is not there, it will not be loaded.
FileInputStream loads the file from a location/absolute path. So you need to provide the full path to you properties file in the constructor of FileInputStream.
If you want to load properties file from classpath which is the ideal situation because you dont want to give the absolute path of the properties then you can do something like following.