How to: Get Minecraft working in Linux

Minecraft Wallpaper

Attempt a quickfix?

If you’re trying to run Minecraft in Linux and it’s failing with errors like:

or

Then the chances are you can fix it up by performing the following actions:

  • Set your LD_LIBRARY_PATH variable with:
  • (if needs be) Get rid of OpenJDK and install the official Sun/Oracle Java binaries if required.

Know how do all that? Awesome – carry on! Not so sure? Read on! ;-D

Setting the correct JRE location

First up, check if you have Java installed by typing java -version, if it comes up with something like the below, then you’re got Java installed, now we just need to find out where:

If you didn’t get anything similar to the above you might want to install the official Oracle Java implementation, which I put together a brief step-by-step for here.

Assuming you have some variety of the Java Virtual Machine (JVM) install, check if your LD_LIBRARY_PATH environment variable is set with:

If it comes up empty, then we need to find out where Java’s installed and set it correctly. To get the correct path for where your particular Java install is located, you might be tempted to try running which java:

However, this is a little bit of a fib, as Java is part of the alternatives setup where we can have multiple versions installed at once – which means that /usr/bin/java is really a symbolic link to the true java location. To find where it’s really pointing we can either ask update-alternatives how it’s configured like so (and pick a version different version if we want to):

Or we can look closely at the /usr/bin/java symlink:

Which if we then look closely at /etc/alternatives/java then points at:

Same thing as what the alternatives config’s pointing at ;-)

Now that we have the correct path, we can set it in the following manner (remember to substitute your particular Java location into the below lines!):

For 64-bit Linux:

For 32-bit Linux:

With that done, you should be able to see that it’s set by running:

Which should give you something like:

Finally, we should be fit to launch Minecraft like this (assuming the minecraft.jar file is in your home folder):

Or, without setting the memory and classpath variables, like this:

Be aware that the LD_LIBRARY path will only be set for the current session of the current shell, so you’ll have to re-set it a lot. A quick and easy way to do this is to just knock together a quick launcher script as below (substituting your paths in) and throw it in /usr/local/bin:

minecraft.sh

Final Notes

Not being able to set a persistent LD_LIBRARY_PATH is a pain, because it won’t take if set in the ~/.profile or ~/.bash_profile or ~/.bash_rc config files (I’m not so sure about ~/.pam_environment) – which you can read about here: https://help.ubuntu.com/community/EnvironmentVariables.

There’s a fix which involves disabling ssh-agent in this bug report (see post #21 here), but really for the sake of a two line launcher script I think it’s best to just leave it be.

Happy mining and crafting! =D

9 thoughts on “How to: Get Minecraft working in Linux”

    1. Not really – I was just playing around with it to see what all the fuss is about, and then got narked that it wouldn’t play ball – so I fixed it and wrote it up!

      1. Sweet, If you can’t tell already I am addicted. I bought it for $5 AUD when it was in Alpha. I watched minceraft go from a few hills to added weather or mobs etc.. Once it went into Beta it was $15 AUD and now full release is $30 AUD.
        I spend most of my down time on my public Minecraft server with friends.

        1. Cool – and yeah, I bought a copy for Loki for 1200 XBox points or something the other day, so it’s not the cheapest thing. Tho I did get my Android copy for 10 cents when it was on offer in the “1 billion app downloads” promotions =D

Leave a Reply

Your email address will not be published.