Sunday, 11 August 2013

Build Jar File with multiple classes

Build Jar File with multiple classes

Is there a way to build a jar file that is anything inside a specific folder?
Inside my folder I have my main class named "GamesCombined.java" with it's
.class files
Here's what my directory looks like inside GamesCombined folder
-> GamesCombined.java
-> GamesCombined.class //classes*
-> games (folder)
|
|----> pacman (folder)
| |
| |----> PacmanGame.java
| |----> PacmanGame.class //classes*
|
|----> racinggame(folder)
|
|----> RacingGame.java
|----> RacingGame.class //classes*
-> images (folder)
|
|----> pacman (folder)
| |
| |----> //jpg's and png's
|
|----> racinggame (folder)
|
|----> //jpg's and png's
I already made a jar file of the GamesCombined.java by following this
link: http://www.skylit.com/javamethods/faqs/createjar.html
But then it has an error:
Exception in thread "main" java.lang.NoClassDefFoundError:
games/pacman/PacmanGame (wrong name: PacmanGame)
GamesCombined.java has import games.pacman.*;
Is there a way where I could just build a jar file including the other
classes? What should I do? :o
I'm new when it comes on JAR files. :/

No comments:

Post a Comment