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

I have a problem running .jar files by double-clicking them. When I go to the Properties dialogue I can't find Java--only Archive Manager in the list of programs. But java -jar somefile.jar opens the program.

share|improve this question

4 Answers 4

up vote 11 down vote accepted

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 Sun Java 6 Runtime.
  4. Click Close and you should be ready to double click.
share|improve this answer

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

[Desktop Entry]
Exec=java -jar %f

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

share|improve this answer
I assume this .desktop file only gets created if you install the openjdk JRE and not when you install the openjdk JDK, even though the JDK includes the JRE? – Earl Jul 3 at 6:29
Is there any way you can get it to ask you to run in the terminal, perhaps by setting the Terminal value to Terminal=prompt? – Dorian Dore Jul 14 at 23:50


After installing the Java runtime environment you can create a launch icon like other applications in the sistem by making a *.desktop file.
It makes things easier and prettier!

  • Create a folder in a directory of your choice with the *.jar (the application) and *.png (the application icon) files. In this case the directory I will use is /usr/share/folder. For the ~/folder is a good idea to name it with the application name, for example, if the application is VUE name the folder ~/VUE or ~/vue.

    Open the terminal and run the following code line:

    sudo mkdir /usr/share/folder

    Or open your file manager (Nautilus in this case) with super admin privileges by runing the following code line in the terminal:

    gksu nautilus

    After that, go to /usr/share and create the folder folder with the GUI.

  • Also in the terminal and run the following code line:

    sudo gedit /usr/share/applications/*.desktop

(You could use your editor of choice. In this case was used Gedit.)

  • Paste the following code lines in the file you are editing:

    [Desktop Entry]  
    Categories=Category Name  
    Exec=java -jar /usr/share/folder/*.jar  
    Comment=Application Name  
  • Save the file.

(The * is always the same name.)


For the icon sizes, Linux support a variety of image formats (PNG, JPG, SVG, etc.) and sizes (16x16 ~ 512x512 px). You could use a 32x32 ~ 96x96 px PNG file, or a 128x128 ~ 512x512 px SVG file for better results. In this case I think that a 96x96 px PNG is enough for a nice Desktop/Dash.

For more, take a look at:


For this step you have to create a MIME Tipe, if it doesn't exist, and associate it with the application in the mimeapps.list file. For that take a look on the following:

Note: If you find something incorrect, please feel free to edit and correct. Thanks!

share|improve this answer

To make Java open .jar files per default (i.e. double click) right click on any .jar file to select Properties. In the following window select the "Open With" tab to see e.g. the follwing choice:

enter image description here

Select your Java runtime and press Set as default to make this your default application to open .jar files.

share|improve this answer

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.