How run a .jar file with a double-click?

Solution 1:

Maybe you don’t have the runtime environment installed!

To install it try the following instructions.

sudo apt-get install openjdk-7-jre

Or you could install Oracle JRE using the PPA method with the following commands.

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

Then to use it to open .jar files try the following.

  1. Right click the .jar file > Properties.
  2. Click on the “Open With” tab along the top.
  3. Change the default choice to be the java runtime environment that you have installed.
  4. Click Close and you should be ready to double click.

Solution 2:

Adding a file called /usr/share/applications/java.desktop with following content should do the trick.

[Desktop Entry]
Name=Java
Comment=Java
GenericName=Java
Keywords=java
Exec=java -jar %f
Terminal=false
X-MultipleArgs=false
Type=Application
MimeType=application/x-java-archive
StartupNotify=true

After adding this file you should be able to find an entry called Java in the Open file with...-Dialog