Running Minecraft on Ubuntu Desktop Linux

October 12, 2012

If you’re one of the millions of fans of the game Minecraft, you may be aware that it runs on Java, which is available not only for Mac and Windows, but also Linux.

Mac and Windows users have a convenient launcher to start the game—but, if you’re using Ubuntu, how do you get Minecraft running?

We’ll walk you through it here:

Installing Oracle Java on Ubuntu

The first step in running Minecraft on Ubuntu Linux is to make sure you have a version of Java that works well with Minecraft. The site recommends the version from Oracle, rather than the OpenJDK version that’s commonly available on Linux distributions.

First open up a Terminal window, either through the Dash or by pressing Ctrl-Alt-T. Then enter these commands, accepting agreements as you go:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

And you’re set. Now Oracle Java is installed, and we can move on to running Minecraft.

Running Minecraft

Now we need to download the Minecraft launcher (Minecraft.jar) from minecraft.net/download.

When that’s downloaded, you’ll have a .jar file, a compiled Java application which is the launcher and bootstrapper that will download, update, and run Minecraft. You’ll want to put this file somewhere it won’t get accidentally deleted, like your Documents folder.

Then, to start up the Minecraft application, you’ll need to use the terminal. Go back to your Terminal window and navigate to the folder where you saved the .jar file:

cd ~/Documents

Then type:

java -jar Minecraft.jar

and you’ll see the Minecraft bootstrapper load some files into the .minecraft folder in your home folder. Eventually a login window will open up. At this point, you can log in and play.

Creating a shortcut icon to launch Minecraft

If you want to open Minecraft a little more easily, with less typing or from a handy launcher icon, you can make a startup script for it. In the terminal, type:

nano minecraft.sh

and enter these three lines:

#/bin/bash
java -jar ~/Documents/Minecraft.jar
exit

The first line tells the system what interpreter to use for the script— in this case, bash, the same as we’re using at the command line.

The next line tells Java where to find the Minecraft file, with a path directly to where the Minecraft file is located, since this script may not always be in the same place as the .jar file. The tilde (~) here means “the current user’s home directory”—in my case, /home/ssimpson.

Then the exit line tells the system to close the terminal window that the script opens after Minecraft closes—to clean up after ourselves a little bit.

To save this script, press Ctrl-O to write the file to disk, and then press Ctrl-X to leave the text editor.

Then type:

chmod +x minecraft.sh

to make your script executable, so you can double click on it and it’ll open up.

But there’s one more step you’ll need to take. Browse to the folder in the file manager where you created the shell script, and you’ll notice that if you double-click it, it opens up in a text editor.

You’ll need to change how the system reacts to clicking on script files. Go to Edit > Preferences in the menubar for the Files application. Click on the Behavior tab, and under the Executable Text Files section, choose Ask each time

Now, when you double-click the .sh file, you’ll be asked to run it or display it.

Click either Run in Terminal or Run to open up the Minecraft application.

You can move this file to your desktop, or you can create a link to it by right-clicking and choosing Make Link. Then move the resulting link anywhere on your system.

Adding an icon to the Launcher

If you want to add the icon to your Ubuntu Launcher or Dash, you can do that by creating a custom launcher item. Open up your Terminal and install a package called gnome-panel:

sudo apt-get install gnome-panel --no-install-recommends

Then create a new item:

gnome-desktop-item-edit ~ --create-new

And fill in the blanks.

Type: Application in Terminal
Name: MineCraft
Command: /home/ssimpson/Documents/minecraft.sh
(or wherever your shell file is. Avoid using relative paths, such as ~)
Comment: A game about blocks!
Icon: I used an image I found on DeviantArt.

If you have an image you’d like to use as an icon, click the icon button and select it. Then click OK.

This will result in an icon being created in your Home Folder for Minecraft. You can navigate there with the file browser and drag it to the Launcher, as well. But watch out—if you delete the icon from your Home Folder, the Launcher icon will disappear as well.

Once the icon is in your launcher, just click it to launch Minecraft.

Tip: Get rid of the Launcher bar by enabling Auto-hide in the Behavior tab of the Appearance option in the System Settings area.

Have fun! For more information about using Ubuntu, check out the LinkedIn Learning course Learning Ubuntu Desktop Linux.

Topics