I am writing a program which will read a properties file.
I craeted the properties file and placed it in the same location of the class file.
But when I am trying to run the program from eclipse, it can't find the properties file, but if I specify the full path of the properties file, it can read it.
Could anyone please tell how to set the path of the properties file, so that I don't need to specify the full path when reading it.
Thanks,
java_programmer
0
Junior Poster
Recommended Answers
Jump to PostSpecifying a full path guarantees that your app won't run on another machine, and using the class path won't work if multiple users are running the same app.
Much better to useSystem.getProperty("user.home")
to get a reference to the user's home directory, and put the file there, …
All 2 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.