FileNotFoundException for an asset in Distribution

So, I tried a clean and build and that worked. However, if I try and run the application (either through the exe file or launch the jar executable), both return an “IllegalArgumentException”. However, looking at the stack trace, I discovered a “FileNotFoundException” was the real issue here. This happens to be the first asset actually loaded. C:\Users\JSC\Documents\JMonk\KnightGame\dist\assets\Textures\testMap.tmx (The system cannot fi
nd the path specified)
at Method)
at javax.xml.parsers.SAXParser.parse(
at javax.xml.parsers.SAXParser.parse(
at XMLReader.ReadXMLFile.parse(
at mygame.LevelState.initialize(
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(
Dec 27, 2013 8:29:18 AM handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0

Now, I know the assets exist in the lib folder that is built with the distribution, but it seems not to look through the lib.
Is this a path issue? I’m fairly certain others may have had this issue, but I tried searching, and the other results turned up a lot of android related issues.

Here is your problem:

We can’t see what it is, though.

Maybe you are trying to access a raw File instead of looking it up through the asset manager. Hard to guess for sure.

Oh, you are right. I’ve got this line there:

[java]rxf = new ReadXMLFile(“assets/Textures/” + Main.levels[Main.level_count],assetManager,bas);

which goes to my XMLReader, in which i’ve created a SaxParser from Java’s XML reading libraries.

[java]saxParser.parse(xml_to_read, handler);[/java]

The “xml_to_read” is the “assets/Textures/” + … which is the raw path to the file.

Any idea of how to fix/get around this? The saxParser.parse method asks for the raw file path, so I’m not sure how to provide that, unless I manually add the /lib before I clean and built the distributable.

There is no files in the distribution, retrieve your files from the classpath instead of a file. If you did your own Assetloader you did it wrong but as was said, hard to tell how.

Okay. Well, I didn’t do my own AssetLoader, but how does one just load a file as an asset? Using

[java]assetManager.loadAsset(“Textures/testMap.tmx”) [/java]

It gives me a

java.lang.IllegalStateException: No loader registered for type “tmx”

error because my file is “testMap.tmx.” Is there anyway to load any regular file, or must I build my own AssetLoader?

Sorry if this is somewhere in the docs. Just point me there if I’m being retarded. This is my first distribution release and all… :wink:

Again, you can load your file from the classpath if you don’t make your own loader.

Alright, normen, I’m sorry. What does that mean? I know what a classpath means, but if I move around the files, won’t the path change. I must sound like an idiot right now.

@machspeeds said: Alright, normen, I'm sorry. What does that mean? I know what a classpath means, but if I move around the files, won't the path change. I must sound like an idiot right now.

Maybe google “java class resources”

No, the assets folder is added to the classpath root so all paths stay the same (relative to the assets folder).

For “loading files from the classpath”, this is the first google hit:

Both of you are my heroes. Thank you for your patience. normen, your link worked perfectly. If only I understood you earlier.