Friday, July 1, 2016

Installing Minecraft in Fedora 23 and 24

Minecraft on Fedora can be a bit of a pain. You may even have experience working with .jar files, download Minecraft, and it still doesn't work! This post will explain why that is, and how to get the game installed on your computer. You'll be minin' and craftin' before you know it.

Installing Minecraft is as easy as these steps:


  • Download Minecraft
  • Install Java
  • Run
and has one optional step that I highly recommend

  • Create a Desktop file

I've tried to put together a small script to do this for you. If it doesn't work, then follow along with the steps below and tell me which part is giving you trouble:

x86: wget "http://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar" -O ~/Downloads/Minecraft.jar; wget "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jre-8u91-linux-i586.rpm" -O ~/Downloads/jre.rpm; sudo dnf install ~/Downloads/jre.rpm; wget "https://raw.githubusercontent.com/natepisarski/tutpi-sources/master/install-minecraft-fedora-23-24/Minecraft.desktop" -O ~/Downloads/Minecraft.desktop; sudo cp ~/Downloads/Minecraft.desktop /usr/share/applications/;wget "https://github.com/natepisarski/tutpi-sources/blob/master/install-minecraft-fedora-23-24/minecraft.png" -O ~/Downloads/minecraft.png

x86_64: wget "http://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar" -O ~/Downloads/Minecraft.jar; wget "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jre-8u91-linux-x64.rpm" -O ~/Downloads/jre.rpm; sudo dnf install ~/Downloads/jre.rpm; wget "https://raw.githubusercontent.com/natepisarski/tutpi-sources/master/install-minecraft-fedora-23-24/Minecraft.desktop" -O ~/Downloads/Minecraft.desktop; sudo cp ~/Downloads/Minecraft.desktop /usr/share/applications/; wget "https://github.com/natepisarski/tutpi-sources/blob/master/install-minecraft-fedora-23-24/minecraft.png" -O ~/Downloads/minecraft.png

After using these scripts, you should be able to play Minecraft by typing:

cd /usr/java/jre*; bin/java -jar ~/Downloads/Minecraft.jar 

at the terminal, or by rebooting and selecting "Minecraft" from your applications menu.

Download Minecraft
This is probably the easiest step. Assuming you already have a Minecraft account, you can just download the game to get started with this command:

wget "http://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar" -O ~/Downloads/Minecraft.jar
This will put Minecraft inside of your "Downloads" folder in your home directory.


Download and Install Java
Thankfully, because you run Fedora, Java provides a .rpm file for their JRE. This makes the installation far easier.

Also note that we must install Oracle's propriety JRE in order to run Minecraft, as there is (at least at the time of writing) an incompatbility between swing on OpenJDK and the official JDK.

x86 (32-bit) system users can download their rpm from this link.
x86_64 (64-bit) system users can download their rpm from this link.

By downloading either file you are accepting Oracle's license. If those links don't work or are outdated, visit the website directly here: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Find where Java was Installed and Run Minecraft
The .rpm will automatically install Java. But... where. If you tried to do "java -jar Minecraft.jar" right now it would fail still, because it's still using the OpenJDK version of java. In order to launch Minecraft, you have to do this:

cd /usr/java/jre*; bin/java -jar ~/Downloads/Minecraft.jar 

because Java is installed in /usr/java/ in a directory name that corresponds to its version, which is bound to change. If you're comfortable with leaving it at this, you can. However, having to use that command every time you want to play Minecraft is a bit cumbersome, so we're going to make a .desktop file to do it.

Make the Desktop File
.desktop files are what control launching desktop applications on Linux. When you see "Files" and a picture of a filing cabinet that launches nautilus, for instance, that's the result of a Desktop File. We can make our own desktop file to launch Minecraft with that code above. One caveat is that Desktop files aren't run like normal terminal commands, so we have to give our command up there a shell, since it has it change its working directory.

The content of the Minecraft.desktop file should be as follows: 

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Minecraft
Exec=bash -c "cd /usr/java/jre*; bin/java -jar ~/Downloads/Minecraft.jar"
Icon=~/Downloads/minecraft.png
NoDisplay=true

Name[en_US]=Minecraft

which you can write in almost any text editor. This expects there to be an icon for Minecraft in your Downloads folder, but it will launch the game even if there's not.

Great! Now...

Install the Desktop File
Move the file into /usr/share/Applications/. This will install the Minecraft launcher system-wide. It may take a reboot for this to actually work.

And you're ready to roll! Have fun

2 comments:

  1. I'll try this. THANK YOU SO MUCH. *gives 50 cookies*

    ReplyDelete
  2. Games like Minecraft
    Find games like minecraft. Great minecraft games on multiple platforms such as iOS, Android, PC and mac.
    games like minecraft

    ReplyDelete