Page 1 of 1

How to fix Java .jar files not opening with OpenJDK

Posted: Mon Jul 27, 2015 2:15 pm
by xenopeek
Problem and cause
Linux Mint 17.2, and perhaps also earlier versions, use a version of OpenJDK from the Ubuntu package base repositories that apparently no longer includes a file to associate Java .jar files with the OpenJDK Java 7 Runtime (file: /usr/share/applications/openjdk-7-java.desktop). Because of this missing file you can't get your file manager to run Java .jar files. It will always open Java .jar files in Archive Manager.

The easiest solution to this problem is to set a custom command to run for Java .jar files, using the same command as from the no longer included file. Pick your edition of Linux Mint / your file manager from below list and follow the instructions to fix this problem.

(BTW, LMDE 2 users don't have this problem as OpenJDK as packaged by the Debian maintainers does include this file.)

Solution ­for Cinnamon / Nemo file manager
Right-click a Java .jar file in your file manager and from the context menu select "Open With Other Application". In the input box at the bottom of the "Open With" dialog enter this command:
/usr/bin/java -jar
Click on the button "Set as default" and then on the button "OK" to close the dialog. Problem solved. When you now double-click Java .jar files in your file manager they will run as expected.

Solution for KDE / Dolphin file manager
Right-click a Java .jar file in your file manager and from the context menu select "Open With". In the input box at the top of the dialog enter this command:
/usr/bin/java -jar
Then tick the box "Remember application association for this type of file" at the bottom and click on the button "OK" to close the dialog. Problem solved. When you now double-click Java .jar files in your file manager they will run as expected.

Solution for MATE / Caja file manager
Right-click a Java .jar file in your file manager and from the context menu select "Open With Other Application". At the bottom of the "Open With" dialog click on "Use a custom command". Input this command:
/usr/bin/java -jar
Click on the button "Open" to close the dialog. Problem solved. When you now double-click Java .jar files in your file manager they will run as expected.

Solution for Xfce / Thunar file manager
Right-click a Java .jar file in your file manager and from the context menu select "Open With Other Application". At the bottom of the "Open With" dialog click on "Use a custom command". Input this command:
/usr/bin/java -jar
Then tick the box "Use as default for this kind of file" at the bottom and click on the button "Open" to close the dialog. Problem solved. When you now double-click Java .jar files in your file manager they will run as expected.

Re: How to fix Java .jar files not opening with OpenJDK

Posted: Tue Jul 28, 2015 8:46 am
by omer
Thank you! Its working! :mrgreen:

Re: How to fix Java .jar files not opening with OpenJDK

Posted: Wed Jul 29, 2015 7:29 am
by jungle_boy
Good tip!

Re: How to fix Java .jar files not opening with OpenJDK

Posted: Tue Mar 01, 2016 3:47 am
by Fpooi5
That is something I was looking for. Thanks

Re: How to fix Java .jar files not opening with OpenJDK

Posted: Fri Mar 18, 2016 7:30 pm
by Darren754
Thank you! This worked perfectly :D

Re: How to fix Java .jar files not opening with OpenJDK

Posted: Fri Mar 31, 2017 1:49 am
by eva114
The second solution works for me. Thank you very much. That is really what I need! :D

Re: How to fix Java .jar files not opening with OpenJDK

Posted: Sun May 21, 2017 6:43 pm
by Lost Shadow001
Thanks for the tip! :)