Setting up Slick2D with Eclipse

Slick2D is a game engine built atop lwjgl (Light-Weight Java Game Library). I quickly discovered a problem setting it up, and ended up wasting hours trying to fix it.

Before you get started, first you’ll need to download both Slick2D AND lwjgl. You might ask, “Why? lwjgl.jar is included in the Slick2D download.” And that’s where the hours of frustration came in. That jar is no good. You’ll end up a bunch of annoying errors if you try using it.

Now that you have both downloaded, create a lib folder in your eclipse project and copy lwjgl.jar, located in [lwjgl download]/jar/lwjgl.jar to the lib folder of your project. Next copy [slick2d download]/lib/slick.jar to the lib folder. You’ll probably have to hit F5 in eclipse for the new files to appear.

To actually use them, you’ll need to add them to the build path. Right click the project folder inside the package explorer in eclipse. Go to Properties > Jave Build Path > Add JARs. Choose the jars from the lib folder. Now you can use them in your project.

Almost done. Unfortunately, lwjgl relies on native libraries. These libraries should be located in the native folder in your lwjgl download. Copy the folders containing these libraries (Should be named windowsmacosxlinux, and solaris) into your project’s lib folder. Again in the Java Build path, click the arrow to the left of lwjgl.jar. Select Native Library Location. Then click Edit.. > Workspace. Pick the folder that matches your operating system.

Now you should be all set up. Here’s a good tutorial to get you started:
http://thejavablog.wordpress.com/2008/06/08/using-slick-2d-to-write-a-game/

Comments are closed.