I am taking a class in Java, thus they make me program in BlueJ. I like to branch of from the class and program games in my spare time, since games incorparate almost everything in the language. Anyways, i loaded all the libraries into the BlueJ, and programmed the NeHe’s first tutorial. I compiled it without error. However, i got a runtime error on the DisplayMode[] modes = Display.getAvailableDisplayModes(); saying java.lang.NoClassDefFoundError followed by a bunch of places, which i can list if asked. SO…Is there something i didn’t do in BlueJ, or am i missing something?
you probably won’t find much help specifically for blueJ on these forums as I doubt there is anyone else using it The problem does, however, seem to be that the lwjgl classes you need aren’t in your classpath. Most IDEs have options for adding files to the classpath (don’t know if blueJ does though…) so you’ll have to just find the option in blueJ.
I believe this is what you are looking for:
http://www.bluej.org/help/archive.html#tip5
If that doesn’t work, you might try looking for help under a different topic since this isn’t really an lwjgl problem.
Hey this thread is a bit of a stub and an old thread but I recently just figured out how to do exactly this.
In your BlueJ project folder create a folder called “+libs”, put all the jar files for the lwjgl in there.
Now grab the appropriate DLL’s for your OS and put them in your source code folder.
I had two small problems running the lwjgl Nehe code. The first is a problem with importing lwjgl.opengl.glu.GLU;
If you have this problem change
import org.lwjgl.opengl.glu.GLU;
to
import org.lwjgl.util.glu.GLU;
The second problem I had was the system not properly exiting when you close a window.
This would mean you could run the example code once only, the second time it will crash.
To resolve this change append a call to System.exit(1); in the cleanup method after Display.destroy(); is called.
If you do that for every Nehe tutorial then you should have no problem.
They use BlueJ to teach Java at my university so maybe this knowledge will be of help to some students out there.
Is this the dll issue with it reloading the same dll multiple times? Whilst working for the BlueJ/Greenfoot team I wrote a Native Loader library to ensure that classes which use .dll’s are only loaded once. So this might solve your issue.
It was written for Greenfoot; but as Greenfoot essentially runs as a BlueJ project on top of BlueJ, I’d expect it should work for BlueJ too.
Ah that is interesting. I figured that was the problem. My solution was to include a System.exit(1) method. If the system has exited the dll’s will be released and there won’t be a clash. Your Native Loader looks like a more comprehensive solution though for sure.
I guess both solutions are appropriate for anyone using LWJGL with BlueJ or Greenfoot.
And nice to meet someone from the BlueJ/Greenfoot team. You should be proud of your work.