Here's a script to install minecraft and help troubleshoot most issues that can arise:
To get minecraft running, right click the minecraft.jar file, go to properties, permisions, and set it allow running as an executable. Now you can right click it, and run with a java.
If you want to properly have minecraft installed: have its icon, be able to launch with minecraft
in terminal, show up on the applications menu, etc, follow these steps:
1) Download minecraft to ~/.minecraft
wget -P /home/$(whoami)/.minecraft https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar
2) Check which JavaVM is installed and which is set to default.
ls /usr/lib/jvm/
java -version
It is recommended to run minecraft with the latest stable java (7 aka 1.7) from Oracle, though running it with the open-source alternative OpenJDK works too.
If you have the one you want to use, OpenJDK 7 or Oracle Java 7, and it is NOT set as default, skip to step 4; if it is, skip to step 5.
3) Installing Java
To get Oracle Java 7, you need to first add a package repository repository that has it to download, refresh the package list, then download and install it, run
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update; sudo mkdir -p /usr/lib/mozilla/plugins
sudo apt-get install Oracle-java7-installer
To get OpenJDK 7, run
sudo mkdir -p /usr/lib/mozilla/plugins
sudo apt-get install openjdk-7-jre icedtea-7-pluginter
Next check again which is the default JavaVM using java -version
4) Change the default JavaVM
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
5) Extract and rename the Minecraft icon
unzip /home/$(whoami)/.minecraft/Minecraft.jar favicon.png -d /home/$(whoami)/.minecraft
mv /home/$(whoami)/.minecraft/favicon.png /home/$(whoami)/.minecraft/Minecraft.png
6) Create a launcher in /usr/local/games/ so you can run minecraft with just minecraft
.
touch minecraft
echo "java -jar /home/$(whoami)/.minecraft/minecraft.jar" >> minecraft
Moving and changing permission of Minecraft shell script
sudo chmod +x minecraft
sudo mv minecraft /usr/local/games/
7) Install the minecraft icon to your system
xdg-desktop-icon install --novendor /home/$(whoami)/.minecraft/Minecraft.png
rm -rf Minecraft.png
8) Create a desktop launcher (shortcut) for Minecraft
touch 'Minecraft.desktop'
echo "[Desktop Entry]" >> Minecraft.desktop
echo "Version=1.0" >> Minecraft.desktop
echo "Name=Minecraft" >> Minecraft.desktop
echo "GenericName=Game" >> Minecraft.desktop
echo "Comment=Minecraft is a game about placing blocks to build anything you can imagine." >> Minecraft.desktop
echo "Exec=minecraft" >> Minecraft.desktop
echo "Terminal=false" >> Minecraft.desktop
echo "Icon=Minecraft" >> Minecraft.desktop
echo "Categories=Game;Application;" >> Minecraft.desktop
echo "Type=Application" >> Minecraft.desktop
echo "StartupNotify=true" >> Minecraft.desktop
echo "Actions=RunInTerminal" >> Minecraft.desktop
echo "" >> Minecraft.desktop
echo "[Desktop Action RunInTerminal]" >> Minecraft.desktop
echo "Name=Run in Terminal" >> Minecraft.desktop
echo "Exec=sudo gnome-terminal -x minecraft" >> Minecraft.desktop
Granting the launcher executable permissions
sudo chmod +x Minecraft.desktop
Adding the shortcut to your application menu and adding it to your desktop
xdg-desktop-menu install --novendor Minecraft.desktop
xdg-desktop-menu forceupdate
mv Minecraft.desktop /home/$(whoami)/Desktop