Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  question about JARs within JARs  (Read 1683 times)
0 Members and 1 Guest are viewing this topic.
Offline longWriter

Junior Newbie

« Posted 2008-06-07 01:38:00 »


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:

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("") 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
Offline DMastaGX

Senior Newbie

« Reply #1 - Posted 2008-06-07 01:55:36 »

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.
Offline Ivoos

Junior Newbie

« Reply #2 - Posted 2008-06-07 08:28:50 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline longWriter

Junior Newbie

« Reply #3 - Posted 2008-06-10 23:57:29 »

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
Offline zoto

Senior Devvie

Medals: 4

« Reply #4 - Posted 2008-06-12 12:21:38 »

add a line like
Class-Path: lib/
to your manifest file in your jar.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

theagentd (73 views)
2017-02-18 13:42:33

theagentd (78 views)
2017-02-18 13:35:16

h.pernpeintner (1244 views)
2017-01-24 22:39:11

h.pernpeintner (1232 views)
2017-01-24 22:38:32

Galdo (1783 views)
2017-01-12 13:44:09

Archive (1898 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2434 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2286 views)
2016-12-15 21:50:57

Lunch (2365 views)
2016-12-06 16:01:40

ral0r2 (2154 views)
2016-11-23 16:08:26
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!