This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If you use a FileInputStream with a filename, without specifying the directory where the file is in, as you are doing in your code, then Java will look in the current directory (i.e. the directory where you started the program from). It will not automatically search any subdirectories for your file. So if your file "parameters.properties" is not in the current directory, it will not find the file.
Specify the directory name if you want to open a file in a specific directory. For example:
Originally posted by Jesper Young: It will only look for the file in the current directory, ...
Although there is still a trick here, since it possible to execute a Java app from any location, as long as the classpath is still valid. Therefore the definition of "current location" can change and cannot be assumed in the application.
It is often better to place the resource on the classpath (along with the application code) and use the ClassLoader to find the file.