Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to run a small minecraft server via Ubuntu desktop 12.04 for my kids. I got minecraft installed and running, but don't want to run via the Terminal all the time. I'm trying to pin a Minecraft button to the launcher and am running into trouble. Here's what I've tried:

  1. Main Menu (alacarte?) but can't find the icon anywhere; can't drag it from the Main Menu list either.
  2. When that didn't work, I tried creating minecraft.desktop & minecraft.sh files.
  3. I was able to download and get a .png file on the launcher but it won't launch anything.

Here's a rundown of all the commands and scripting I've done:

  1. Terminal Script that does work:

    sara@sara-Dimension-4300:~$ cd /home/sara/MCserver
    sara@sara-Dimension-4300:~/MCserver$ java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
    
  2. "Main Menu" command script:

    java -Xmx1024M -Xms512M -Xincgc -jar /home/sara/MCserver/minecraft.jar
    
  3. minecraft.sh script:

    #!/bin/bash
    cd $(home/MCserver "$0")
    java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame
    
  4. minecraft.desktop script:

    [Desktop Entry]
    Name=MineCraft
    Comment=
    Exec=/home/sara/MCserver/minecraft.sh
    Icon=/usr/share/icons/Minecraft_Block.svg
    Terminal=false
    Type=Application
    StartupNotify=true
    
  5. All files are stored in the MCserver folder. When I open the folder on Launcher, it starts at Home -- then MCserver is one of the folders within Home (I don't see "Sara" as a subdirectory of Home here -- sometimes I see it when accessing other files somewhere).


@edwin: here's the copy of la /home/sara

sara@sara-Dimension-4300:~/MCserver$ la /home/sara
.bash_history  examples.desktop       .ICEauthority       .profile
.bash_logout   .fontconfig            .java               Public
.bashrc        .gconf                 .local              .pulse
.cache         .gnome2                MCserver            .pulse-cookie
.config        .goutputstream-KIZ8WW  minecraft.desktop~  Templates
.dbus          .goutputstream-QXYAXW  minecraft.png       .thumbnails
Desktop        .goutputstream-UZYSWW  .mission-control    Videos
.dmrc          .gstreamer-0.10        .mozilla            .Xauthority
Documents      .gtk-bookmarks         Music               .xsession-errors
Downloads      .gvfs                  Pictures            .xsession-errors.old
share|improve this question
    
Are you trying to just play Minecraft or are you trying to set up a Minecraft server to play on? In the beginning you say you are trying to set up a Minecraft server, but in your Minecraft.sh script you are trying to launch the .jar of the game itself instead of the .jar to start a server to play on. –  Jop Vernooij May 17 '13 at 16:43
    
Ah. Look like I'm mixing 2 diff things … I'm trying to setup/run a server. I don't want to start the server in the Terminal. I was hoping to create a shortcut so my kids could start & shutdown the server without my help. Can this easily be done? –  blokizaki May 17 '13 at 18:04

1 Answer 1

The script should read:

#!/bin/bash
cd $HOME/MCserver
java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame

After writing it, you should make it executable, so open a terminal and if the script is in a file called minecraft.sh (check if the casing is right, upper and lower case matter!):

$ cd $HOME/MCserver
$ chmod +x minecraft.sh

Finally you must put minecraft.desktop in /usr/share/applications or in $HOME/.local/share/applications (not both, only one of the two):

  • Do this if you want all users to have the Minecraft icon:

    $ sudo mv minecraft.desktop /usr/share/applications

  • Or do this if you want only the current user to have the Minecraft icon:

    $ mv minecraft.desktop $HOME/.local/share/applications

The launcher should appear in the Unity Dash (so you can search for it typing "Minecraft"). Then you can just drag it to the panel.

share|improve this answer
3  
You don't need to put it in /usr/share/applications here. For personal launchers, one can put them in $XDG_DATA_HOME/applications which defaults to being ~/.local/share/applications. –  dobey May 17 '13 at 17:24
    
Thanks for adding this point, I will edit the answer. –  edwin May 17 '13 at 20:23
    
@edwin (and dobey) -- thanks for your fast response & help. I believe I followed your instructions well. Although now I have 2 MC icons and neither one launches anything. Or maybe it does and I have no idea how to tell. I'm not sure what to do next. Any advice? I copied and entered the script as provided. Although I think I had to change HOME to home since that's how it appears on my system -- I may have kept the last "mv" edit with HOME. Would that affect anything? –  blokizaki May 21 '13 at 15:32
    
@edwin -- here's copy of my Terminal screen after successfully entering your script: sara@sara-Dimension-4300:~/MCserver$ $ cd $HOME/MCserver $: command not found sara@sara-Dimension-4300:~/MCserver$ $ chmod +x minecraft.sh $: command not found sara@sara-Dimension-4300:~$ cd $home/MCserver bash: cd: /MCserver: No such file or directory sara@sara-Dimension-4300:~$ cd ~/MCserver sara@sara-Dimension-4300:~/MCserver$ chmod +x minecraft.sh sara@sara-Dimension-4300:~/MCserver$ mv minecraft.desktop $HOME/.local/share/applications –  blokizaki May 21 '13 at 15:34
    
Notice that you must type $HOME and not $home, case matters. Could you please post the result of la /home/sara and la /home/.local/share/applications? –  edwin May 22 '13 at 16:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.