31

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.)

1
  • I ended up just creating a folder in home called .launchers and dragging launchers I created on my desktop to that folder. From there I dragged the launcher on to the Unity launcher. Now the launcher works, and the original launcher is hidden. The only downside is that after launching the application, I have the launcher icon, and the running application icon in my launcher. Still waiting on a better solution.
    – aboutros
    Apr 10, 2011 at 21:46

8 Answers 8

24

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.

3
  • 1
    This is the correct answer, I was looking through here to see if someone already posted it. This is the same way I did it though I used ~/.local/share/ for my setup.
    – brim4brim
    May 27, 2013 at 0:08
  • One thing you could add to this that I did (and really liked) is adding some desktop action groups to the .desktop for different minecraft launchers so you can start minecraft using, for example, the magic launcher, technic pack launcher, or ftb launcher. Jul 28, 2013 at 19:39
  • You can download the image in to /usr/share/icons/scaleable/apps/minecraft.svg and so you could refer to the icon as minecraft instead of giving a full path. You may need it to add it to the hicolor folder instead. Using ~/.local/share instead of /usr/share should work fine as well.
    – Adam L. S.
    Jul 28, 2014 at 12:04
6

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:

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.

0
2

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

4
  • 1
    I don't seem to have a unity folder in .gconf/desktop. I just have a gnome folder.
    – aboutros
    Apr 10, 2011 at 21:13
  • 1
    Is this for Unity for Maverick? Seems a lot of the people on the Ubuntu forums you linked are running 10.10.
    – aboutros
    Apr 10, 2011 at 21:38
  • @Spacecraft: Oh, sorry I think that's an old version of unity :s But you could just create a shell script, save it to your home folder, then drag it to your unity dock and don't delete the shell file. That should work too :)
    – omnidan
    Apr 11, 2011 at 5:07
  • Folders aren't present in default install of ubuntu 12.04, and dragging a shell script to the unity doc also doesn't seem to be allowed...
    – Kzqai
    Oct 2, 2012 at 2:20
2

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

1
1

What you'll need to make a minecraft launcher:

  1. Full path to your minecraft.jar
  2. Minecraft icon picture in *.svg format Note: I used the one at this site: http://gimilkhor.deviantart.com/art/Minecraft-icon-193038524 . But, in order to convert the *.png icon to *.svg , I had to install Inkscape, open the *.png, then save it as *.svg (Gimp won't do this). You can install inkscape with:

    sudo apt-get install inkscape
    

Here's how to make the launcher. We'll assume minecraft is in /home/joe-user/Downloads/minecraft/minecraft.jar, and we'll assume the *.png icon file from the above website has opened with inkscape, then saved in *.svg format to ~/Pictures/minecraft.svg

Create a launcher as follows. We'll use vi because we are badass.

sudo vi /usr/share/applications/minecraft.desktop

Put the text below into the launcher, then save it (modify the Exec path to match your minecraft.jar location):

[Desktop Entry]
Name=MineCraft
Comment=ThisGameRocks
Exec=java -jar /home/joe-user/Downloads/minecraft/minecraft.jar
Icon=minecraft
Terminal=false
Type=Application
StartupNotify=true

Now, you have to copy the minecraft.svg file to /usr/share/icons/hicolor/scalable/apps/minecraft.svg (as root, change the source path to fit your situation) so the launcher can find it and use it.

sudo cp ~/Pictures/minecraft.svg /usr/share/icons/hicolor/scalable/apps/minecraft.svg

Notes:

  • The minecraft.jar file should have chmod 755 minecraft.jar permissions
  • The minecraft.svg file should have chmod 644 minecraft.svg permissions
  • Also, the above assumes you have jre installed

    sudo apt-get install openjdk-7-jre
    

Now, you'll be able to find minecraft in the unity searchglass. Then, once you launch it, you can right-click the icon and set "Lock to Launcher".

1
  • Did not work for me for any stage (Ubuntu 12.04)
    – Kzqai
    Oct 2, 2012 at 2:16
1

Try using alacarte Install alacarte.

sudo apt-get install alacarte

Then create a new menu item, with the command being "java -jar path/to/your/minecraftfile.jar".

After that search for the name you gave it in ~/.local/share/applications. Drag and drop it to the Launcher or lock the application once it's up to the launcher (by right clicking it while its running).

Much easier then creating a .desktop file

1
  • +1 for solution that does not need gksu ;)
    – Takkat
    Apr 13, 2013 at 14:57
1

According to http://www.omgubuntu.co.uk/2013/04/minecraft-installer-for-ubuntu you can do this:

sudo add-apt-repository ppa:minecraft-installer-peeps/minecraft-installer
sudo apt-get update && sudo apt-get install minecraft-installer
1

With the copy/paste desktop file entry Ubuntu 12.04 and Ubuntu Studio displayed the default icon rather than Minecraft's in Unity and Docky. However, for whatever reason it worked when it was dropped on the desktop.

The problem was caused by the extra space after '[Desktop Entry] ' in the answer above. By removing the space with gedit finally the correct icon got displayed.

So here's the corrected desktop file entry for copy/paste to save some suffering: :)

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .