I updated ubunut to 15.04 today. Now when I try starting a jar file from the gui it only opens the archive manager.
Checking the open with tab in Properties I can't find Openjdk. I got both Openjdk java 7 and 8 installed according to the software center but despite that they don't show up in the list.
That means that the solution here: How run a .jar file with a double-click? doesn't work for me.


2 Answers 2


Switching java to Oracle JDK is just a workaround in my opinion, as the OP wanted to know why it doesn't work anymore with OpenJDK. Anyway, I fixed it myself using this answer on Ask Fedora.

Basically you first have to create a file javajar.desktop with following contents in /usr/share/applications/.

[Desktop Entry]
Exec=java -jar %f
Comment=Launching Jar files

After that, execute this command terminal to add your .desktop file to mimetypes list:

echo "application/x-java-archive=javajar.desktop" >> ~/.local/share/applications/mimeapps.list

Of course this all has to be done with root rights. Voilà, jars now immediately open as GUI.


For some reason the desktop file for OpenJDK is not installed, even though this file is listed.

$ apt-file list openjdk-8-jre | grep desktop        
openjdk-8-jre: /usr/share/applications/openjdk-8-java.desktop
openjdk-8-jre: /usr/share/applications/openjdk-8-policytool.desktop

$ ls -l /usr/share/applications/openjdk-8-java.desktop
ls: cannot access /usr/share/applications/openjdk-8-java.desktop: No such file or directory

$ dpkg --get-selections | grep openjdk-8
openjdk-8-jre:amd64             install

But you can also use Oracle Java(TM):

Install Oracle Java(TM) with this commands and you have an entry in open with:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

To select your default Java, use the following command.

sudo update-alternatives --config java

But this has no influence on the menu item "Open with"

  • If I want to use Openjdk, would I use apt-get install openjdk-8-jre-default instead?
    – Skadlig
    Apr 25, 2015 at 19:10
  • Sorry no, but if you don't have a major reason for the OpenJDK, then I would recommend Oracle.
    – A.B.
    Apr 25, 2015 at 19:12
  • For this you need sudo update-alternatives --config java
    – A.B.
    Apr 25, 2015 at 19:20
  • I don't need open sourced java as such so Oracle will do fine and your solution worked @A.B.
    – Skadlig
    Apr 25, 2015 at 19:24
  • 1
    Strange though that it stopped working after I did the upgrade from 14.10 to 15.04
    – Skadlig
    Apr 25, 2015 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.