Ubuntu – Problem running jar from gui in 15.04

15.04jarjavaopenjdk

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.

Best Answer

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"

Related Question