question about JARs within JARs

Hey,

I am creating a Java game, and I’d like to include JInput with it so that players can use controllers to play the game. The problem is, I’m trying to package up this game as an executable JAR file, and I’m afraid I don’t know how to set things up so that classes in the executable JAR can see the classes contained in the jinpur.jar file; whenever the execution in the executable JAR gets to a class where there are Controller or Component-type objects, I see ClassNotFoundExceptions.

I found a link here that gives a partial explanation for an idea of how to load classes from a JAR file within an executable JAR file, and I’ve tried to implement it, with only partial success:

http://forum.java.sun.com/thread.jspa?messageID=10239359&tstart=0

When I say “partial success”, I mean that I can get an URLClassLoader that (I’m 95% sure) looks at the jinput.jar file, but when I try to call loadClass(“net.java.games.input.ControllerEnvironment”) on that URLClassLoader, I get ClassNotFoundExceptions.

Can anyone else tell me how I can load classes from a JAR within an executable JAR? Or even any advice on how to get an executable JAR file so it can use classes contained within another JAR file would be great.


The peace of Jesus Christ be with you

I’m also creating a game, and I have an Animation that moves freely inside a frame. I’m trying to add a side scrolling tile map, but I’m kind of stuck there. Anyways, I test it with my controller using a program called “Joy To Key” it transfers controller input into keyboard presses when you configure it. If what you want to do is not possible this can serve as a second option.

If you have your executable jar, you should make a folder called “lib” in the same folder as your jar, and put your other jars in there.

Thanks for the advice, Ivoos, but I tried making a folder called “lib” in the same directory as my executable JAR file, and I put the JInput.jar file in the lib folder, and it still didn’t work. Any other ideas? Anyone?


The peace of Jesus Christ be with you

add a line like
Class-Path: lib/
to your manifest file in your jar.