How to fix Java .jar files not opening with OpenJDK

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
xenopeek
Level 25
Level 25
Posts: 29506
Joined: Wed Jul 06, 2011 3:58 am

How to fix Java .jar files not opening with OpenJDK

Post 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.
Image
omer

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

Post by omer »

Thank you! Its working! :mrgreen:
User avatar
jungle_boy
Level 7
Level 7
Posts: 1812
Joined: Thu Aug 19, 2010 2:51 pm
Location: Amazon Rainforest

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

Post by jungle_boy »

Good tip!
Samsung Odyssey, Octa-core, i5 9300H, Geforce GTX 1650, 16GB RAM, SSD SAMSUNG NVMe 500GB
LM 21 Cinnamon
Fpooi5

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

Post by Fpooi5 »

That is something I was looking for. Thanks
Darren754

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

Post by Darren754 »

Thank you! This worked perfectly :D
eva114

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

Post by eva114 »

The second solution works for me. Thank you very much. That is really what I need! :D
Lost Shadow001

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

Post by Lost Shadow001 »

Thanks for the tip! :)
Locked

Return to “Software & Applications”