[Solved]Problem Gradle build running from command line AssetNotFoundException

My application works fine running from intellij
but when I do a “gradle build”
and try running on command line using the bat file created in the zip from build\distributions

I get a AssetNotFoundException at the following line.

JmeDesktopSystem : showSettingsDialog
final URL iconUrl = JmeSystem.class.getResource(iconPath.startsWith("/") ? iconPath : “/” + iconPath);
if (iconUrl == null) {
throw new AssetNotFoundException(sourceSettings.getSettingsDialogImage());
}

I tried remote debugging and spitting out the classpath but can’t see what the problem is

C:\tools\testJME\fps-42\fps-42\bin>fps.bat
C:\tools\testJME\fps-42\fps-42\bin\..\lib\fps-42.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-core-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-desktop-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-lwjgl-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\lemur-1.10.1.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\lemur-proto-1.9.1.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-blender-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-bullet-native-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-networking-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jME3-testdata-3.0.0.20130526.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\slf4j-simple-1.6.1.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\groovy-all-2.4.12.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\assets.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\lwjgl-2.9.3.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\guava-19.0.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\slf4j-api-1.7.13.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\dense64-0.27.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\simple-0.27.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-effects-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\core-0.27.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-bullet-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\lwjgl-platform-2.9.3-natives-windows.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\lwjgl-platform-2.9.3-natives-linux.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\lwjgl-platform-2.9.3-natives-osx.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jinput-2.0.5.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\denseC64-0.27.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jme3-terrain-3.1.0-stable.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jutils-1.0.0.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jinput-platform-2.0.5-natives-linux.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jinput-platform-2.0.5-natives-windows.jar;C:\tools\testJME\fps-42\fps-42\bin\..\lib\jinput-platform-2.0.5-natives-osx.jar
Listening for transport dt_socket at address: 5005
Exception in thread "main" com.jme3.asset.AssetNotFoundException
    at com.jme3.system.JmeDesktopSystem.showSettingsDialog(JmeDesktopSystem.java:149)
    at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:152)
    at com.jme3.app.SimpleApplication.start(SimpleApplication.java:119)
    at fps.client.FPSClient.main(FPSClient.java:112)

Note that when I run using intellij iconUrl = file:/C:/dev/jme-wksp/fps/build/classes/main/

Any help would be appreciated.

[SOLVED] EDIT: It turns out all i need to do was add a random folder to classpath. So I added “;.” to my classpath. I guess it requires some folder to default to if things are not found. Note that it could also be c:\foo and still works.
Not sure why its needed but at least it solves my problem.

1 Like

I’m having the same problem.

How does one add a random folder to classpath??
I’m using JMonkey 3.1 IDE and using “Run” to execute.

Thanks.

You need to figure out which jar it ended up in.

Without knowing more about your source code, files, etc… my guess is that the icon is maybe in with your src/main/java files and not in src/main/resources?

When you run from the IDE, it’s doing some weird black-magic to put directories on the classpath that will eventually be bundled into jars for the app to run outside of the IDE.