I have a dir structure for Intellij 12:
...
...test
- java
- com.mycompany.myproject
- package1 (contains code, etc,.)
This can be solved in several ways. An example of a good approach would be the following folder structure:
src
main
java
resources
test
java
resources
When this is done, you put all you java classes under src/main/java/com.mycompany
package and any resources under /src/main/resources/com/mycompany
folder.
To link them together, go to the project properties, and find the Path tab. Mark the src/main/java
and src/main/resources
as source folders. (see the screen-shot attached)
If you link them together, you'll be able to use getResourceAsStream() method. If you wonder why you should use the following folder structure - this is standard maven way of keeping things clean and tidy.