How to add Minecraft to the Unity launcher?

I'm having trouble getting Minecraft to launch when I add it to the launcher. If the game is running, I can right click on the icon in the launcher and select "keep in launcher" and the icon stays, but the game won't launch from it.

If I create a launcher on the desktop, then drag that launcher to the unity launcher, the game will start. If I remove the launcher from the desktop, it stays in the Unity launcher, but will not start any more.

Is there some way to add it to the Unity launcher so that it will actually launch?

(Blech, I've said launch far too many times.)


Solution 1:

Setting up a Minecraft launcher on Ubuntu 12.04, these steps worked for me, mostly pieced together from the various other tips.

In a terminal, first fetch a Minecraft image icon:

cd /usr/share/icons; sudo wget http://images.wikia.com/yogbox/images/d/dd/Minecraft_Block.svg

Then create a minecraft.desktop file (using the gedit text editor to keep it user-friendly; just enter the whole "gksudo ..." command at the command line):

gksudo gedit /usr/share/applications/minecraft.desktop

and paste in these contents, and then Save of course:

[Desktop Entry] 
Name=Minecraft
Comment=
Exec=/opt/minecraft.sh
Icon=Minecraft_Block
Terminal=false
Type=Application
StartupNotify=true

(Note: you can also paste directly into the file by using

sudo sh -c 'xsel -ob > /usr/share/applications/minecraft.desktop'

if you have xsel installed.)

Finally (almost), open up your file manager and go to /usr/share/applications - either click the Home Folder icon in your launcher and navigate, or here's the terminal quickie:

nautilus /usr/share/applications &

Locate your new Minecraft entry, and drag it over to your launcher bar.

At this point, you're practically done, except in this case I've created a little Minecraft starter script, saved in /opt/minecraft.sh, which assumes the minecraft.jar file is also saved in /opt. You can change all these "/opt" references to be wherever you've saved the original minecraft.jar file (be sure to change the Exec value in the minecraft.desktop file too).

The minecraft.sh file needs to contain just these three lines:

#!/bin/bash
cd $(dirname "$0")
java -Xmx1G -Xms512M -cp minecraft.jar net.minecraft.bootstrap.Bootstrap

(NOTE: for versions older than 1.6.1, you will need to use net.minecraft.LauncherFrame instead of net.minecraft.bootstrap.Bootstrap. The internal structure of the file and classes has changed as of 1.6.1.)

and of course that script needs to be executable, e.g. with the command

sudo chmod a+x /opt/minecraft.sh

If you have a system with more memory or notice poor performance when playing with higher render distances, you can increase the value of the -Xmx1G flag as desired. This tells Java the maximum amount of memory it's allowed to use. -Xmx1G means that it has a cap of 1 GB. -Xmx2G would be 2 GB, -Xmx3G would be 3 GB, and so on.

That's it! Using the starter script, and ensuring it cd's to the folder that contains the minecraft.jar file, seems to be a helpful step that other instructions overlooked.

Solution 2:

There is a much easier way to do this. Go to the software centre and search for the package "Main menu" and install it. Also, go to Google images and find a PNG of the minecraft icon: here's one:

  • PNG of minecraft icon

Download (save) the PNG and minecraft.jar. I suggest put it in the Home Folder.

Open up "Main Menu" by hitting the Dash BFB and search for Main menu. Click on Games and choose New Item. Next, click the spring button and choose the PNG you downloaded and put in the home folder. For Name, call it Minecraft, description, whatever. For command use this:

java -Xmx1024M -Xms512M -Xincgc -jar ~/minecraft.jar

Save it and it should now be in your Menu :D. You can then pin it to the launcher if you want. It will work like any other launcher icon :D.

Solution 3:

You need a .desktop file for the MineCraft launcher.

gksudo gedit /usr/share/applications/minecraft.desktop

Put the following text into this file:

[Desktop Entry]    
Name=MineCraft    
Comment=    
Exec=COMMAND_FOR_MINECRAFT_LAUNCHER    
Icon=ICONNAME   
Terminal=false    
Type=Application    
StartupNotify=true

Now open a File manager (nautilus). Press Strg + H to show hidden files.

Go to: .gconf-> desktop-> unity-> favourites-> launchers

You'll see many folders starting with "app-". Create a folder for your program. Name it "app-MineCraft".

Now enter one of these app- folders, copy the xml file, paste it into your "app-MineCraft" folder and open the xml file with a text editor. Rename the *.desktop in this file with MineCraft.desktop.

Log out and in again (or restart your computer).

If you did it right, you should now see your icon on the dock.

I hope this helped you, Daniel

Source

Solution 4:

There is an awesome Minecraft installation script for Ubuntu that will solve all your problems. Here is the link --> http://www.ubuntuvibes.com/2011/04/minecraft-installation-script-updated.html

This will create a Minecraft shortcut icon in actual menu under games. So you need to just launch Minecraft, right click the icon and select 'Keep in Launcher'.

I have done the same thing and it's working nicely. Here a screenshot:

Minecraft