I try to load a property-file that is here
<project>/resource/text/translation_en.properties
With the following code (in a static context, no Objects are initialized from me right now):
<This_Classes_name>.class.getResourceAsStream("/resource/text/translation_en.properties");
Why do I load it this way? First I use the class Object because getResourceAsStream() is not static and I learned through googling that I should use this method to load my property-file. Then I use a / that Java does not look relative to my Main.java, but the Project. Though, I still get null using that.
How can this not work, if there is a file in that exact place? What does Java do here?
The resources need to be in the Classpath. One option is to copy the whole /resource folder int your source folder. One other option is to create a new source folder containing only the resources and move the /resource folder there. Don not make the /resource folder a source folder unless you want to use
getResourceAsStream("/text/translation_en.properties");