Hello: I have not found anything useful on the web, so I ask the question. How can I read files from the resource folder?
I have a source folder (src) and a resources folder (res). Both are specified in Java as a source folder. I tried to use: new File(Main.class.getClassLoader().getResource("shader.glsl").getFile());
but it didn't work. Please do not be too strict just ask if I forgot something to mention.
These are the errors that I get:
java.io.FileNotFoundException: shader.glsl (Das System kann die angegebene Datei nicht finden)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at com.leocat.game.shader.ShaderProgram.loadShader(ShaderProgram.java:54)
at com.leocat.game.shader.ShaderProgram.init(ShaderProgram.java:18)
at com.leocat.game.shader.StaticShader.init(StaticShader.java:8)
at com.leocat.game.states.GameState.init(GameState.java:29)
at com.leocat.game.Game.init(Game.java:91)
at com.leocat.game.Game.updateGLFW(Game.java:60)
at com.leocat.game.Game.run(Game.java:132)
at java.lang.Thread.run(Unknown Source)
Thanks in advance!