I want to learn game programming and since I'm taking a course in Java at school I thought a java game would be best to start out in. Slick2d seems to be the best option for this, and they say it can be installed on Linux but the whole process to install it is way over my understanding. Can anyone here tell me how to install this on my computer?


You don't necessarily have to "install" slick2d per se, it's mostly just a matter of including the files in your project, and setting it up to use them correctly.

The tricky thing about Slick2D is that it uses native libraries in order to use your video hardware - you have to tell java where to find the native libraries. Take a look at the directory structure and the run script of my pet project: https://bitbucket.org/willismichael/terra-incognita - It's mostly written in Clojure, but it should give you an idea of what you need.

You'll see that I have all of the java libraries (jars) directly inside the lib folder. Also in that folder is another folder called native, which contains three folders: linux, macosx, and windows. Each of these has the native libraries for the corresponding OS. Then, in the root folder of the project I have run.bat for Windows users, and run.sh for Mac and Linux.

In run.sh, you'll see a parameter passed to java called -Djava.library.path that points to the folder with the native libraries. You'll also notice that the classpath includes both slick.jar and lwjgl.jar, both of which are required to run a slick app.

If you only want to run on Linux, you don't even have to get as complicated as I did, all you have to do is include the linux natives, and hardwire your startup script to include them.

If you're lauching your project from an IDE like Eclipse or Netbeans or something, you'll have to figure out how to tell the IDE about the native libs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.