AssetNotFoundException Eclipse Plugin Blender File

I use jmonkey within an eclipse rcp application and everything works right when I am starting it out of my IDE.
The blender files are located inside a assets directory in the eclipse plugin project. Now if I build a productive version of my application then the assests could not be loaded, but the assests,the blender file, are available in the plugin directory. I think it’s a path problem.

This is the how I load my blender files:
assetManager.loadModel(“file1.blend”);

I hope someone has a solution. Thanks in advance.

Give us the exception’s stack trace.
In general you have to add the assets folder to the run class path of the project.

Or you can add the assets folder to the source folders of your project.

com.jme3.asset.AssetNotFoundException: turntable3.blend
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:283)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:374)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:378)
at com.bauerfeind.ma.control.engines.Java3D.createTurnTable(Java3D.java:682)
at com.bauerfeind.ma.control.engines.Java3D.simpleInitApp(Java3D.java:343)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)

I think a eclipse project(plugin) doesn’t work like a normal java jar, where I can use <>.class.getResource(…)

You might need to write and register your own Locator to the assetmanager.

I suggest you just follow this wiki tutorial:
https://jmonkeyengine.github.io/wiki/jme3/setting_up_jme3_in_eclipse.html
All you have to do is add the assets folder to the classpath,as it is done here.

I followed it and managed to load an asset in 30 minutes,despite the fact that I have never used Eclipse for JME development before.I use the default SDK.

@Empire_Phoenix
Thank you very much for that hint. That’s the solution!
1.) I must get the current path of my plugin as follow:

	public static String getCurrentPluingPath(){
	Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
	if( bundle == null )
		throw new RuntimeException("Could not resolve plugin: " + Activator.PLUGIN_ID + "\r\n" +
				"Probably the plugin has not been correctly installed.\r\n" +
				"Running eclipse from shell with -clean option may rectify installation.");
	
	URL pluginURL = null;
	try {
		pluginURL = FileLocator.resolve(bundle.getEntry("/"));
	} catch (IOException e) {
		throw new RuntimeException("Could not get installation directory of the plugin: " + Activator.PLUGIN_ID);
	}
	String pluginInstallDir = pluginURL.getPath().trim();
	if( pluginInstallDir.length() == 0 )
		throw new RuntimeException("Could not get installation directory of the plugin: " + Activator.PLUGIN_ID);
	
	if( Platform.getOS().compareTo(Platform.OS_WIN32) == 0 )
		pluginInstallDir = pluginInstallDir.substring(1);
	return pluginInstallDir;
}

2.) Register the path as FileLocator

@Damien_M
My problem wasn’t to load a asset. My problem was that my model wasn’t found in the final product. In the IDE was everything fine. I’ve posted my Solution

Yeah if you use the default build script all non .j3o objects are excluded from the final distribution automatically.
Anyway you should not use .blend files in your distributable product,as they are not engine-optimized as .j3o models are.
Better to convert them in .j3o format and use them instead.Good luck