works just fine, but from within my executable .jar file, it does not see the sound. The sound is being included in the .jar file, so what is the correct way to access it from inside of the .jar?
Ok, I tested it with eclipse 3.5. Most of the files were loaded from within the jar but I had one problem-file.
With extending it to another jar didn't work (n)either. Only thing that helped was copying the whole package in the directory where my fat.jar was and including the current directory to the classpath. Like this:
Actually that made me curious and I had a deeper look into that. So it seems that filenames in jar-archives are casesensitive and using the resourceloader not. So maybe checking all filesnames can help here also....
After I changed the filename even the fatjar works...
Hi, I am not home yet to test my filenames (by the way thanks for all the help with this) but there is one thing I want to know.
How are you loading your resources? I know these loaders are picky with the "/"
Also, where do you include your resources relative to your source folder?
I am just wondering, thanks. Also I will post again when I get home and try out the names of the files, to let you know how that goes.
//edit:
I have been looking around on the forum and I am becomming more and more confused. There seems to be different ways to load a resource, the way I showed above as well as ResourceLocaterTool. According to one post on this forum, the ResourceLocaterTool is the way to get a resource from inside a jar file.
I am just curious ttrocha about how you, in your tests, loaded your resources with code.
if (meshURL == null)
throw new IllegalStateException(
"Required runtime resource missing: "
+ ninjaMeshUrlString);
if (matURL == null)
throw new IllegalStateException(
"Required runtime resource missing: " + matUrlString);
try {
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE,
new RelativeResourceLocator(matURL));
// This causes relative references in the .material file to
// resolve to the same dir as the material file.
// Don't have to set up a relative locator for TYPE_MODEL
// here, because OgreLoader.loadModel() takes care of that.
} catch (URISyntaxException use) {
// Since we're generating the URI from a URL we know to be
// good, we won't get here. This is just to satisfy the
// compiler.
throw new RuntimeException(use);
}
matLoader.load(matURL.openStream());
if (matLoader.getMaterials().size() > 0)
loader.setMaterials(matLoader.getMaterials());