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
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]
Encoding=UTF-8
Version=1.0
Type=Application
NoDisplay=true
Exec=java -jar %f
Name=OpenJDK
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"
- 92,125