I have had some problems with the resource-locations during the webstart deployment as well, a few weeks ago.
The problem is, that you are not allowed to use this.getClass().getClassLoader().getResource("blaa.3ds") within the code, when you want to deploy it as webstart.
try {
locatorURL = new URL(this.getClass().getResource(""), relativePathToYourModelLocation);
locator = new SimpleResourceLocator(locatorURL);
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
System.out
.println("VB3DBaseGame:init() - have setup the RESOURCELOCATOR-URL to the following path: "
+ locatorURL);
}
//In my case all resources(Models,Textures,Audio) are in the same directory.. so use the same locator for those //types.
//Or set up a new locator with the relative path to Audio/Texture for each type, and use this instead.
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_MODEL,
locator);
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE, locator);
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_AUDIO,
locator);
System.out.println("This is " + modelNameToLoad + " " + modelFile);
BinaryImporter importer = new BinaryImporter();
maggie = (Spatial)importer.load(modelFile.openStream());
//More code goes here
It does work when deployed as Java webstart following the webstart tutorial on the jme wiki. Remember to include your 3ds / jme or whatever (textures included) in your jar file when creating it in i.e Eclipse. Also do a print of the URL to check what folder it is referring to. Make sure that folder exist :) maybe its located under src, or maybe bin, you see the point?
- Jars have to be signed.
- Mime type has to be correct on webserver.
- JNLP has to be correct.
Does it webstart at all? If it does jar signing, mime-types and jnlp is probably correct.
OT: Considered converting the .3ds to .jme for faster loading times btw?
OT: Considered converting the .3ds to .jme for faster loading times btw?
that is only recommended for distributions where the jME XML format is locked into the distributed jME code.
(basically you might want to wait until it's time for a 'release' of your game, and even then make sure to keep the originals handy...)
If you convert all your models, then the jME format changes (which can happen) all of those converted models may not load anymore.