LWJGLCanvas class definition not found

Hi all!



I’m new here, so please excuse any beginner mistakes that I might’ve made  :roll:



I’ve followed the Getting started tutorial to the point (which reminds me; the CVS section really needs an update to reflect the changes of WinCVS - I must’ve spend close to two hours trying to get it right!). I’ve managed to get the source and compile it without any errors using Ant.

However, when I tried running the test applications using the command I ran into problems. The resolution screen shows up correctly, but when I hit “go” it crashes, telling me that it can’t find the class definition in LWJGLCanvas. I haven’t installed LWJGL manually, but according to the tutorial it ought to work flawlessly when I’ve downloaded the source using CVS.

I’ve searched the forums and found some threads on similiar problems, but they didn’t fix my problem. I’ve also tried installing the newest display drivers, but that didn’t help either.



I’ve made a BAT-file that is placed in the jME directory (the directory where “lib”, “target” etc. are located). It contains the following command:

java -Djava.library.path=./lib -classpath ./lib/lwjgl.jar;./lib/jogg-0.0.5.jar;./lib/jorbis-0.0.12.jar;./target/jme.jar;./target/jme-effects.jar;./target/jme-model.jar;./target/jme-sound.jar;./target/jme-terrain.jar;./target/jmetest.jar;./target/jmetest-data.jar jmetest.effects.TestDynamicSmoker



When running the script it fires up the resolution selection screen, and when clicking “go” it terminates. Here’s the output:

2005-12-19 13:40:44 com.jme.app.BaseGame start

INFO: Application started.

2005-12-19 13:40:44 com.jme.system.PropertiesIO <init>

INFO: PropertiesIO created

2005-12-19 13:40:44 com.jme.system.PropertiesIO load

WARNING: Could not load properties. Creating a new one.

2005-12-19 13:40:50 com.jme.input.joystick.JoystickInput get

INFO: Joystick support is disabled

Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: com/jmex/awt/lwjgl/LWJGLCanvas

        at com.jme.system.DisplaySystem.getDisplaySystem(Unknown Source)

        at com.jme.system.lwjgl.LWJGLPropertiesDialog.verifyAndSaveCurrentSelection(Unknown Source)

        at com.jme.system.lwjgl.LWJGLPropertiesDialog.access$200(Unknown Source)

        at com.jme.system.lwjgl.LWJGLPropertiesDialog$3.actionPerformed(Unknown Source)

        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

        at java.awt.Component.processMouseEvent(Unknown Source)

        at javax.swing.JComponent.processMouseEvent(Unknown Source)

        at java.awt.Component.processEvent(Unknown Source)

        at java.awt.Container.processEvent(Unknown Source)

        at java.awt.Component.dispatchEventImpl(Unknown Source)

        at java.awt.Container.dispatchEventImpl(Unknown Source)

        at java.awt.Component.dispatchEvent(Unknown Source)

        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

        at java.awt.Container.dispatchEventImpl(Unknown Source)

        at java.awt.Window.dispatchEventImpl(Unknown Source)

        at java.awt.Component.dispatchEvent(Unknown Source)

        at java.awt.EventQueue.dispatchEvent(Unknown Source)

        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

        at java.awt.EventDispatchThread.run(Unknown Source)



I really hope anybody’s able to help me because jME looks really impressive and I would love to play around with it :wink:

Thanks in advance!

I dont see jmex-awt.jar in your path that apparently is needed now…for this test, that is :?

mcbeth said:

I dont see jmex-awt.jar in your path that apparently is needed now..........for this test, that is :?

Thanks for helping me out, but adding (./target/)jmex-awt.jar to the list doesn't help. It still throws the same error, at least.
I can run other peoples jME applications without any problems, so it must be the linking with LWJGL that's messed up somehow. It bugs me that it isn't working, I thought I had left linking problems behind when I switched from C++ to Java  :(

This isn't a native library issue.  That would throw an UnsatisfiedLinkingError (or something along those lines).  This problem has to do with not having a JAR correctly in your classpath.  The LWJGLCanvas.class is found in the jme.jar, so you have something misconfigured in your classpath.



darkfrog

it's jme-awt.jar not jmex-awt.jar in my book…

Sion,



You might just try downloading the nightly build and go from that and see if it works.



darkfrog

MrCoder said:

it's jme-awt.jar not jmex-awt.jar in my book...


JACKPOT!  :D

There it was, it is working perfectly now!! Thanks a lot for helping me out, everybody, very glad I got it working!
Now you must excuse me, I've got some jME samples to play around with!  8)

PS. It might be a good idea to update the "Getting started" tutorial to prevent others having the same problem as me ;)

great…but it might also be good java-training to look what the files in the target dir are named when creating the .bat file  :wink:

PS. It might be a good idea to update the "Getting started" tutorial to prevent others having the same problem as me


It's in the wiki... hence anyone can update it. Including you. ;)

mojomonk said:

PS. It might be a good idea to update the "Getting started" tutorial to prevent others having the same problem as me


It's in the wiki... hence anyone can update it. Including you. ;)


Yeah well, if I was a registered member that is ;)

However, I don't think I'm qualified to start making changes in the "Getting started" tutorial. I still haven't figured out how to run my code, although I've spend the last three hours trying to do it. I can run the samples that the engine comes with beautifully, but I can't seem to run my own code. My code is compiled to a bunch of class files and not archived in a .jar-file, so I can't figure out how to run it. Work, dammit! :x
MrCoder said:

it's jme-awt.jar not jmex-awt.jar in my book...


my bad....sorry ://
Sion said:

mojomonk said:

PS. It might be a good idea to update the "Getting started" tutorial to prevent others having the same problem as me


It's in the wiki... hence anyone can update it. Including you. ;)


Yeah well, if I was a registered member that is ;)

However, I don't think I'm qualified to start making changes in the "Getting started" tutorial. I still haven't figured out how to run my code, although I've spend the last three hours trying to do it. I can run the samples that the engine comes with beautifully, but I can't seem to run my own code. My code is compiled to a bunch of class files and not archived in a .jar-file, so I can't figure out how to run it. Work, dammit! :x



you can set classpath to a directory the same way as you do to a jar archive...

Ok, updated the class path issues, what WinCVS updates need to be made?

MrCoder said:

you can set classpath to a directory the same way as you do to a jar archive...

Okay, then perhaps you'll be able to help me figure out how I have to set up my batch file for the references to work.

My current working directory has this structure:
MyGames
-- Game1
---- run_game.bat
---- src
(jME source)
---- lib
(LWJGL binaries)
---- jmetest
(...)
base
TestSimpleGame2.class

And the run_game.bat file has this command:
java -Djava.library.path=./lib -classpath ./lib/lwjgl.jar;./lib/jogg-0.0.5.jar;./lib/jorbis-0.0.12.jar jmetest.base.TestSimpleGame2

I get the following error when trying to run it:
Exception in thread "main" java.lang.NoClassDefFoundError: jmetest/base/TestSimpleGame2

What's wrong with my batch file, or am I missing some libraries or somesuch?

mojomonk said:

Ok, updated the class path issues, what WinCVS updates need to be made?

The

you need to add the directory containing jmetest to your class path if you are going to run it like that. In your case, you need to add . to your classpath. You are also going to need to add the jme jars to the classpath.

mojomonk said:

you need to add the directory containing jmetest to your class path if you are going to run it like that. In your case, you need to add . to your classpath. You are also going to need to add the jme jars to the classpath.

I had already tried adding the jar-files, but couldn't get that to work. I changed the jar-directory to "jme" instead, and then added it to the batch file, and now it actually works! Fantastic! Here's the batch:
java -Djava.library.path=./lib -classpath ./lib/lwjgl.jar;./lib/jogg-0.0.5.jar;./lib/jorbis-0.0.12.jar;./jme/jme.jar;./jme/jme-effects.jar;./jme/jme-model.jar;./jme/jme-sound.jar;./jme/jme-terrain.jar;./jme/jmetest-data.jar;./jme/jme-awt.jar; jmetest.base.TestSimpleGame2

Thanks for putting up with my clueless attempts and helping me. Oh, yeah and thanks for sharing this awesome engine! :D