LWJGLException when trying to run my slick game

Hi, im using Slick, and I made a pong game. The IDE is JCreator. It works fine when run from the IDE. However, whenever i use the Jar Maker from the GTGE website, http://www.goldenstudios.or.id/products/utilities/jarmaker/index.php, to make a jar, and I get an error, in the command line, saying

Exception in thread “main” java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at Sub.main(Sub.java:347)

line number 347 points to AppGameContainer app = new AppGameContainer(new Sub());

What do I do?

the lwjgl.jar is missing from the classpath

In my MANIFEST, i put

Class-Path: jinput.jar lwjgl.jar natives-win32.jar slick.jar

What else does it want from me? is there a specific way to do it?

thanks

not sure, never used jarmaker. is the jar file located at the correct position?
its a very simple error, with a very simple solution. Make sure the jar is on the classpath.

I know it should be an easy error, but the thing is, this jar, along with the other jars (slick, jinput), are already in the classpath, as I put them in the classpath using the manifest file. The jars are working fine except for the LWJGL jar. Very odd, and frustrating. Is it something to do with the lwjgl version, the JVM version, or a difference in the versions of java? Is there a specific folder the jars have to be in, because i just threw the jars in the same folder as the class files. Thanks

bump

Why are you using the manifest file to add the other jars to the classpath? don’t think thats a really good way.

You can use the command line like

java -cp lwjgl.jar;slick.jar;jinput.jar; -Djava.library.path=native\win32 org.yougame.MainClassName

just put that in a batch file(text file renamed to have a .bat extension) and you should be able to launch you game.

Firstly you are adding the jars to the class path, then pointing to the location of the natives files with “natives\win32” (being the folder that contains them) and the part after than is the path to your main class.

Neat! it runs my game, but now what do i do to make my executable jar, now that i added the jars to the classpath?

I have a quick question about putting the class path info in the manifest of your jar file

You said you had this
Class-Path: jinput.jar lwjgl.jar natives-win32.jar slick.jar

but then you said
The jars are working fine except for the LWJGL jar.

Is the LWJGL jar upper case like that? If it is, it would need to match on the Class-Path line in your manifest.

No, the case is lower case on the file and on the manifest. thats not the problem

Wanna post your jar (or a test version) up somewhere?

Kev

I’m not sure how to post my jar, and i dont have a website or anything, but heres what my manifest file says:

Manifest-Version: 1.0
Main-Class: Sub
Class-Path: jinput.jar natives-win32.jar slick.jar lwjgl.jar

and here’s what my main class is:

public static void main(String[] args) 
	{ 
		try 
		{ 
			Sub game = new Sub("JPong"); 
         	AppGameContainer app = new AppGameContainer(game, 640, 480, false); 
         	
         	
			
			
			app.setVSync(true);
			
			app.setShowFPS(false);
			app.start(); 	
			
		} 
		catch (SlickException e) 
		{ 
			e.printStackTrace(); 
		} 
		
	} 

all of my jars and classes are in one folder. need anything else?

Are the dlls in the directory you’re running from?

Are the JARs in the directory you’re running from?

Kev

Have you tried changing the order of the jars on the Class-Path line?
Are there any extra chars at the end of the line?
Do you have one blank line at the end of your manifest fle?
What happens when you move just your jar files (as all of your classes should be in one of the jars) to an empty directory and use the command line / batch file to launch the game?

Okay, I have a folder with:

jinput-dx8.dll
jinput-raw.dll
lwjgl.dll
OpenAL32.dll
Ball.class
Paddle.class
Sub.class
jinput.jar
lwjgl.jar
natives-win32.jar
slick.jar
ball.PNG
cooltext.png
instructions.PNG
paddle.PNG
ak47.wav
explode.wav
m4a1.wav
Moonlight.wav

this is the folder that i put in the exeutable jar

In that case seems like it should would. If you can’t post a zip of this directory somewhere then mail it over (kev at cokeandcode dot com) and I’ll happily try and work out whats going on.

Kev

Sent. Did you get it?

Worked fine here:

http://www.cokeandcode.com/downloads/pong/Pong.jar

Executed in that directory runs your “JPong” (note: I switched Mindnight.wav for a smaller file so I didn’t have to distribute 32meg of wav)

The manifest used looked like this:


Main-Class: Sub
Class-Path: jinput.jar lwjgl.jar slick.jar


You may have fallen over the need for a carriage return on the end of the Class-Path: line? That sometimes hits people. The directory in the link above includes the files I needed to make it run.

EDIT: Had to modify the case of the PNG extensions too. Your code references them as lower case, on windows file systems that doesn’t matter but once the files are in the JAR it’s case sensitive.

Kev

Ah, it finally works, thank you