Using GCJ with LWJGL?

I tried compiling one of my games using GCJ and it said


BestGameEver.java:7: error: Class or interface `org.lwjgl.opengl.glu.GLU' not found in import.
   import org.lwjgl.opengl.glu.GLU;

My game uses LWJGL, obviously. So is it possible to use GCJ at all?

I don’t konw GJC, but this looks like a classpath problem - ie: the compiler can’t find the lwgjl jar.

Yeah, which is odd because I have the .jar in my Java extensions folder, so everything should be able to read it. So I thought.

never install lwjgl in the extension folder, it’s asking for trouble!
always install it in its own folder and point to it using classpath and java.library.path

Yeah, people have told me not to do this, but never told me why. What’s the problem exactly? And don’t I have to put the .dll files there anyway?

And as another question: if I’m compiling through the unix box how do I set the classpath correctly? I only know how to do it with a compiler.

Because you’ll end up with multple versions of the files in the classpath. Other LWJGL applications will crash because it uses your files in the ext directory wich is a of a different version. Nigthmare, so just don’t do it.

Yea I couldnt run your game because of it.

This might be a bit off-topic but are there any windows binaries of GCJ? Does MingW provide it?

thinks the layout of the gcc site is confusing… links to links to links…

Nm… http://www.thisiscool.com/gcc_mingw.htm

Okay, so if I have it in the classpath and create a jar, can I bundle the LWJGL jars inside my jar and have it work? I’ve never bothered doing this the correct way because I keep getting issues with it.

Also, if I have the .dll files in the classpath will that work correctly as well? I thought that I flat out needed these in the ext folder.

Thanks guys.

You have to have the .dll-files in your java.library.path.

There are three ways to do this:

  • either have your .ddls in the working directory
    (eg. placing it beside your excutable jar and state in your readme, that one has to start the game from this directory)

  • place the files in the PATH-environment
    (eg. use a start-script, that adds the appropriate directory to the PATH-environment variable)

  • or start the jar with -Djava.library.path=
    (eg. use a start-script, that calls java with this system property set to the appropriate directory)

I am not sure, if it is possible to use GCJ to compile a LWJGL game. It seems unlikely to me and even if it works, it might not give a runtime performance gain (if this is what you are after…).

Thanks very much for the help.

I thought I might as well try GCJ with LWJGL, because one of the reasons keeping me from using it in the first place is Swing. As I’m not using it now, I thought I’d give it a shot and see what happens.