Storing program options in Java
i am developing a java application. I've got a txt file such like this:
Component(Journal, Account, AnalysisCodes...):
Journal
*****
Method(Query, Import, CreateOrAmend...):
Import
*****
Username:
PKP
*****
Password:
test
*****
Host:
localhost
*****
Port:
8080
*****
Program's path:
C:/Connect Manager/
*****
XML Name:
ledger.xml
*****
This java program does not write anything in this file, it just reads it.
However i could not figure out where to store this txt file. Path must be
same for every users since it is hard coded inside. I cannot read path of
the program if i don't know the path of program.
Here is my code:
String lineconfig="";
String pathconfig= "C:/Connect Manager/" + "config.txt";
BufferedReader readerconfig= new BufferedReader(new FileReader(pathconfig));
while((lineconfig=readerconfig.readLine())!=null)
{
stringList.add(lineconfig);
}
readerconfig.close();
As you see, i need an exact location for pathconfig.
Sorry if i caused any confusion in question. I would appreciate your
suggestions.
No comments:
Post a Comment