Lightweight Java Game Library – on Eclipse

I decided to have a go with the Lightweight Java Game Library today.  LWJGL I’ve been looking at Java a lot recently due to my work with Android OS.  A bit a searching showed that the currently popular Minecraft uses LWJGL.  Kevin Glass uses it for a lot of his projects on Coke And Code.

Using Eclipse has been really rewarding so I am continued to use this for my experiments with LWJGL.  Decompressing the zip file for LWJGL was easy but linking that to a project in Eclipse was a little more tricky.  The problem I had was when setting up the project to find the JARs. Documentation was a little sparse for Eclipse version 3.5.2 .

After creating a project for your new LWJGL project, select “Project->Properties” from the top menus.  In this menu select “Java Build Path”.  On this dialogue page we are going to add the JARs and add the native libraries. (i.e. .DLL or .SO files)

Select “Add External JARs” and browse to the ‘jar’ folder where you decompressed the zip files and add the “lwjgl.jar” file and maybe “lwjgl_util.jar”.

Now for the tricker bit.  It was more a case of finding how to set this up since  I’d never done it before.

Select “Add Libraries” then “User Library”.  From the new dialogue select “User Libraries” and use “New” to add and name a new library.  Press “OK” afterwards since we’re not actually adding any JARs here.  Press “Finish” since we have now added our library.  BUT we’re not done yet!  Your newly created library will be listed in the “Java Build Path” but it doesn’t actually contain anything yet.  Press the little “+” on the library name and you will see a couple of new items.  One item is “Native library location”.  This is where you will need to put the location of the “.dll” or “.so” files. Click on the item and navigate to the folder containing the library files.

All done!

%d bloggers like this: