Load .md2 from jar

Hello,

I want to create a webstart package of my program and therefore I need to read everything out of jar’s.
But I have a problem with the MD2Loader2, I can’t get it to work.

MD2Loader2 loader = new MD2Loader2();       
MD2Model model = loader.load(Maze.class.getClassLoader().getResource(modelName),new FileInputStream(modelName),skin);

It works when the program is unpacked but when I pack it into a jar, I get “java.io.FileNotFoundException: model/player.md2” (which is the value of the modelName String) when I try to run it

How can I access the file model/player.md2 that is in my maze.jar?

have you tried getResourceAsStream("…") ?

Yes, but when I use the Line

MD2Model model = loader.load(Maze.class.getClassLoader().getResource(modelName),Maze.class.getClassLoader().getResourceAsStream(modelName),skin);

I get

Exception in thread "main" java.lang.NullPointerException at org.xith3d.loaders.md2.MD2Loader2.toByteArray(MD2Loader2.java:435) at org.xith3d.loaders.md2.MD2Loader2.load(MD2Loader2.java:379) at org.xith3d.loaders.md2.MD2Loader2.load(MD2Loader2.java:276) at MD2Load.loadModel(MD2Load.java:56) at Maze.<init>(Maze.java:255) at Maze.main(Maze.java:203)

Which refers to the model load line of code.
Any other suggestions?

Nobody else who works with md2 models?

(I don’t)

Is maze.jar in your classpath ?