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.

My problem is, that I do want to create a .desktop file for Technic Launcher, which is an alternative launcher for Minecraft. It comes in the form of a .jar file and I want to create a menu entry for it. How would I write such a .desktop file?

My attempt was the following:

[Desktop Entry]
Type=Application
Name=Technic Launcher
Comment=Minecraft Launcher for Technic Pack, Tekkit, Hack/Mine and Yogbox
Exec=/home/benjamin/Applications/Minecraft/TechnicLauchner/technic-launcher-latest.jar
Icon=/home/benjamin/Applications/Minecraft/TechnicLauchner/icon.png
Terminal=false
Categories=Game;ActionGame;AdventureGame;RolePlaying;

This didn't work, hence my question. What did I do wrong? Is it even possible to point to a .jar file?

share|improve this question

4 Answers 4

.jar files are not executable, so you have to open them with something (java):

Exec=java -jar /home/benjamin/Applications/Minecraft/TechnicLauchner/technic-launcher-latest.jar

Anyway, I wouldn't recommend creating those files manually from scratch.

share|improve this answer

You can make it manualy, or using AlacarteInstall. Here's the way:

1: Install Alacarte

It will install some Gnome dependencies. Nothing to worry about.

2: Create a new entry

In the command entry, click browse and select your .jar file.

  • You may need to add /usr/bin/java -jar to the start of the Command, so that it looks like /usr/bin/java -jar /home/angel/minecraft.jar.

enter image description here

3: Make the file executable

Go where you have your .jar file. Right click, properties, permissions, check the 'Allow run as a program' option.

4: Look for it in the Dash

There you should have it. Just click and enjoy!

enter image description here

Extra: Here's the icon

share|improve this answer
    
Personally, I prefer menulibre. It was added with the last App showdown and offers a better experience than alacarte, imo: myapps.developer.ubuntu.com/dev/apps/1173 –  Glutanimate Sep 24 '12 at 16:38
    
@Glutanimate I've never used MenuLibre before. And I tried to use it in the answer. But due to a bug in Quantal I can't install it, so I chose Alacarte. –  Ángel Araya Sep 24 '12 at 16:55
    
I always thought it was very easy to create .desktop files, because KDE has this functionality built-in. –  Oleh Prypin Sep 25 '12 at 13:14

You just messed up a part of the Desktop file. This is what it should look like (sorry for the thread resurrection):

[Desktop Entry]
Type=Application
Name=Technic Launcher
Comment=Minecraft Launcher for Technic Pack, Tekkit, Hack/Mine and Yogbox
Exec=java -jar /home/benjamin/Applications/Minecraft/TechnicLauchner/technic-launcher-latest.jar
Icon=/home/benjamin/Applications/Minecraft/TechnicLauchner/icon.png
Terminal=false
Categories=Game;ActionGame;AdventureGame;RolePlaying;

Then just type

sudo chmod +x "/home/(username)/Desktop/Technic Launcher.desktop"
share|improve this answer

On a XUbuntu I just gave the the absolute path of the jar file and maded it executable using the chmod +x on jar file.

At permissions tab just clicked over run file as an program.

Maybe you also be in need to associate the .jar extension with the java application. With Xubuntu you can do this via Configuration manager Dialog and choosing the System -> MIME Editor by editing the entry at application/java-x-archive to the preferred Java Virtual Machine.

share|improve this answer

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.