How to fix Java .jar files not opening with OpenJDK

Questions about applications and software
Forum rules
Before you post please read how to get help
User avatar
xenopeek
Level 24
Level 24
Posts: 21367
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

How to fix Java .jar files not opening with OpenJDK

Postby xenopeek » Mon Jul 27, 2015 2:15 pm

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
Level 1
Level 1
Posts: 39
Joined: Sun Feb 16, 2014 4:32 pm

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

Postby omer » Tue Jul 28, 2015 8:46 am

Thank you! Its working! :mrgreen:
Image

User avatar
jungle_boy
Level 7
Level 7
Posts: 1716
Joined: Thu Aug 19, 2010 2:51 pm
Location: Amazon Rain Forest Land

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

Postby jungle_boy » Wed Jul 29, 2015 7:29 am

Good tip!

Fpooi5
Level 1
Level 1
Posts: 6
Joined: Tue Mar 01, 2016 3:31 am

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

Postby Fpooi5 » Tue Mar 01, 2016 3:47 am

That is something I was looking for. Thanks

Darren754
Level 1
Level 1
Posts: 1
Joined: Fri Mar 18, 2016 6:36 pm

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

Postby Darren754 » Fri Mar 18, 2016 7:30 pm

Thank you! This worked perfectly :D

eva114
Level 1
Level 1
Posts: 3
Joined: Fri Mar 31, 2017 12:14 am

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

Postby eva114 » Fri Mar 31, 2017 1:49 am

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

Lost Shadow001
Level 1
Level 1
Posts: 1
Joined: Sun May 21, 2017 6:37 pm

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

Postby Lost Shadow001 » Sun May 21, 2017 6:43 pm

Thanks for the tip! :)


Return to “Software & Applications”

Who is online

Users browsing this forum: jimallyn and 9 guests