Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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