How do I create a .desktop file for a .jar file?

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?


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


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


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"

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

On the permissions tab just clicked over run file as an program.


Or you may want 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.