Cannot load texture when Loading 3DS files in JAR


the 3DS file and its texture are in the package "MyApp/data/models/". I use the following code to load them.

protected Node loadModel(String url)
           Node temp;
           MaxToJme C1=new MaxToJme();

Because URL cannot point to jar directories. Point it to a file in that folder instead.

or, if it is in a jar, you need it in the classpath and then you can use a relative link.

How can I load a 3DS file with a specified texture. I think if I use

URL stateTextureDir=ModelManager.class.getClassLoader().getResource("MyApp/data/models/");

the texture will be automatically loaded. But if the model and the texture are packaged into a JAR, "ModelManager.class.getClassLoader().getResource("MyApp/data/models/") " return null.

If they are in a jar AND in the classpath, AND their path in the jar is MyApp/data/models/[mystuffhere], that should work.  Otherwise, TextureKey can be setup by the programmer to do more advanced things to find a texture.