Eclipse Properties File
I have an application that uses a properties file that was manually added to the / project / bin folder (Eclipse project). The application finds the file using:
this.getClass().getClassLoader().getResourceAsStream("filename.properties")
Now I want to add this file to Eclipse, so it is actually part of the project. In which directory should I create the file and how can I make sure the application finds it?
Thank.
source to share
You can put the .properties file in any directory of the project source directory ( src
by default) so that it will run in the build directory ( bin
by default) as a "resource" when the project is built. Since the directory is bin
generated, you cannot change its contents manually, so as you describe.
No need to call getClassLoader()
; just getClass().getResourceAsStream("foo")
fine.
source to share