Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have a .desktop file for a bash script, but when I launch the .desktop file nothing happens except that a terminal window is shown for half a second.

If I run the bash script directly (without the .desktop file), the script works fine (bash file is called 'minecraft'):

java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame

The file is executable.

This is my minecraft.desktop file:

[Desktop Entry]

minecraft.desktop is located in ~/.local/share/applications

share|improve this question
Thanks for posting your solution. You should move it to an answer and accept it, though, so your question shows up as answered. – Scott Severance Aug 15 '12 at 17:18

3 Answers 3

up vote 2 down vote accepted

Apparently the script couldn't find the .jar file. When I run the bash file using the .desktop file, I assume it runs the bash file in the directory of the .desktop file (~/.local/share/applications).

When I give the full path name to the jar, it works fine:

java -Xmx1024M -Xms512M -cp /home/bram/Applications/Minecraft/minecraft.jar net.minecraft.LauncherFrame
share|improve this answer

You have two options:

1.) Set the working directory in the .desktop file to the location of the .jar

2.) Use full paths in your Bash script (like you did)

share|improve this answer

You can run it as a background task:

nohup java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame

(Note the nohup at the beginning used to make keep running)

share|improve this answer
Still nothing happens. The jar still isn't launched. – Bram Meerten Aug 15 '12 at 12:19
Try removing the space right before the &. – hexafraction Aug 15 '12 at 12:20
No, still nothing.. – Bram Meerten Aug 15 '12 at 12:22
OK... Do you mind the script running at all times? – hexafraction Aug 15 '12 at 12:23
Yes, the script opens a jar file (which is a game) and I don't want the game to be running all the time. – Bram Meerten Aug 15 '12 at 12:25

Your Answer


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.