I need to know that how to read the directory path from a .properties file in java.
for example,
class clazz
{
string filename="d:/file.txt";
public void somemethod()
{
FileWriter f=new FileWriter(filename, true);
// etc
}
i want to read the filename from .properties file rather than from a variable.
how it can be done?
A fairly simple way is to use a resource file, through the
ResourceBundleclass.Where
com/fileis thefile.propertiesin thecompackage.This file could have a line like this:
For get this particular data.
I hope this can help you. Good luck!