Slick Forums

Discuss the Slick 2D Library
It is currently Sun May 26, 2013 8:32 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Jun 20, 2012 10:38 pm 
Offline
User avatar

Joined: Wed Jun 20, 2012 10:33 pm
Posts: 35
Location: Doncaster, South Yorkshire
I've made a game that works fine within Eclipse. But, it won't run when I double click the icon, and when I run it through cmd, I get the following:

Code:
C:\TakeFlight>java -jar TakeFlight.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/newdawn/slick/state/StateBasedGame
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.newdawn.slick.state.StateBasedGame
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 12 more
Could not find the main class: george.game.takeflight.Game. Program will exit.


I'm not sure why it can't find StateBasedGame, as I've directed the path to the Slick folder and it's having no problems with the lwjgl jar ... Any ideas?

Thanks!


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 1:25 pm 
Offline

Joined: Mon May 07, 2012 11:36 pm
Posts: 93
It seems it can't find your main class either "Could not find the main class: george.game.takeflight.Game"

What did you use to build it? JarSplice?


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 4:05 pm 
Offline
User avatar

Joined: Wed Jun 20, 2012 10:33 pm
Posts: 35
Location: Doncaster, South Yorkshire
I used Eclipse to export the jar, I don't really understand why it can't find the main class... D:


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 7:55 pm 
Offline
Regular

Joined: Thu Sep 22, 2011 4:39 pm
Posts: 165
Location: Belgium
if you open the jar with winzip or winrar, do you find back your class?


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 8:39 pm 
Offline
User avatar

Joined: Wed Jun 20, 2012 10:33 pm
Posts: 35
Location: Doncaster, South Yorkshire
Image

I get this^^ The main() class is in the Game class.


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 8:40 pm 
Offline
User avatar

Joined: Wed Jun 20, 2012 10:33 pm
Posts: 35
Location: Doncaster, South Yorkshire
Oh, sorry for the huge image, I put in the wrong one D:


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 9:28 pm 
Offline
Regular

Joined: Thu Sep 22, 2011 4:39 pm
Posts: 165
Location: Belgium
google is your friend :)
cause i don't use eclipse, rather intellij.. however this sounds interesting:
http://www.dreamincode.net/forums/topic ... ain-class/
someting todo with the fact that it's compiled on the 7 th version and runned on the 6th..


Top
 Profile  
 
PostPosted: Fri Jun 22, 2012 7:51 am 
Offline
User avatar

Joined: Wed Jun 20, 2012 10:33 pm
Posts: 35
Location: Doncaster, South Yorkshire
Google is my best friend :wink:

Ah, thankyou very much, that solved the problem with the main class! :D

Unfortunately the problem with StateBasedGame persists :/


Top
 Profile  
 
PostPosted: Fri Jun 22, 2012 11:12 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1469
Delinitor wrote:
Google is my best friend :wink:

Ah, thankyou very much, that solved the problem with the main class! :D

Unfortunately the problem with StateBasedGame persists :/

This means you didn't set your class-path for the JAR, or that it can't find "slick.jar" within the set class-path.

You could also try putting the dependencies in the same folder. But you'll also need a "-Djava.sun.library" flag for the natives -- i.e. a batch script, or terminal shell file.

Better to just use JarSplace if you want a simple way to distribute a game...
http://ninjacave.com/jarsplice


Top
 Profile  
 
PostPosted: Sat Jun 23, 2012 10:39 am 
Offline
User avatar

Joined: Wed Jun 20, 2012 10:33 pm
Posts: 35
Location: Doncaster, South Yorkshire
THANKYOU SO MUCH!!!!!!!!!!!!1111eleven

I think you may have just saved my sanity. JarSplice was ridiculously easy to use too. Fan-freakin'-tastic.

:D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group