property file not reading

not able to read property file
I am trying below example
http://www.avajava.com/tutorials/lessons/how-do-i-read-a-properties-file.html

wheni run java application by keeping test.proerties file in same package i am getting below error

java.io.FileNotFoundException: test.properties (The system cannot find the file specified)
      at java.io.FileInputStream.open0(Native Method)
      at java.io.FileInputStream.open(FileInputStream.java:195)
      at java.io.FileInputStream.<init>(FileInputStream.java:138)
      at ReadPropertiesFile.main(ReadPropertiesFile.java:13)

please advise
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jan LouwerensSoftware EngineerCommented:
The file doesn't need to be in the package (or even in the source at all), it just needs to be in the same directory that you're running the java program from. (It's a file that's accessed at runtime, not at compile time.) Alternatively, you can specify the path to the file. ("test.properties" wilol just mean that it will look in the current working directory at runtime.)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
You don't actually say how you try to open the file yourself.
Check the file actually exists in the path you supply when opening the file.


ps.  At times Windows uses an internal method to locate some files in special locations (eg. the user specific directories - multiple languages, same path internally).  What you see as a path in explorer is a translation of the real path.  So be careful if you hard code the path.
0
AndyAinscowFreelance programmer / ConsultantCommented:
The file is probably not where it is expected to be by a false assumption being made
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.