When I run from jme, everything is ok. If I do a clean & build, then run the resulting .jar I get this error:
java.lang.Error: the folder assets/data was not found.
at model.builders.definitions.DefParser.getFiles(DefParser.java:52)
at model.builders.definitions.DefParser.(DefParser.java:32)
I’ve checked, and assets.jar contains the assets/data folders and files. So I don’t understand what’s wrong
assets/ only exists in the SDK because the project is run with the project folder as root which contains the folder assets/, when you deploy the app the folder is compressed into a jar file which is added to the project classpath. So you’ll have to fetch your file from the classpath (no File()) and without the assets/ prefix.
InputStream in = this.getClass().getResourceAsStream(“data/SomeTextFile.txt”);
InputStream in = this.getClass().getResourceAsStream(fileName);
Returns null, even though fileName is present (minus the assets/ prefix). I have to say that I’m calling it from a library and not from my game, like this:
goldmonkey.jar
/src (the call happens here)
mygame.jar (includes goldmonkey.jar)
/src/ invokes the goldmonkey appstate
/assets/ the file I’m looking for