Assets can be found when running from Netbeans IDE but can't when running from outside

Hi, I have 2 similar problems with assets.



1.

If I try to load font (.fnt file) by assetManager when app is started from Netbeans, it works.

If I try to load font when app is started from command line, it cannot be found.



Why?

I have found mention about this problem here:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:asset_manager

but it talks about OgreXML files only.



And furthermore I don’t use JME SDK.



2.

If I try to load material definition when project is executed from Netbeans this works:

[java]Material mat = new Material(assetManager,“MatDefs/Light/Lighting.j3md”);[/java]



But if I try to run standalone executable, “MatDefs/Light/Lighting.j3md” can’t be found. But this works:

[java]Material mat = new Material(assetManager,“Common/MatDefs/Light/Lighting.j3md”);[/java]



It seams quite strange.



Lighting.j3md is placed here:

assets/MatDefs/Light/Lighting.j3md

assets/Common is empty.

Missing info:

how are you running from the command line?



It all comes down to the classpath, really.

@drhml said:
And furthermore I don't use JME SDK.


Ah, this could be the critical info. The SDK does some automatic stuff for you to make sure that assets.jar is on the classpath.

Whatever manual methods you are using aren't doing that.
1 Like

Assets must be packed into assets.jar file?

Maybe I have missed the idea of assets.

I have thought that assets folder should be placed in the same folder as executable jar.

If you do that then you have to specify a locator, as the manual says.

1 Like

Specified, works. This is the simplest solution for me.



Thank you. Both.