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
_zac

How to fix Java .jar files not opening with OpenJDK

Post by _zac »

Sorry to dig up a nearly 3 year old thread, but I tried the fix and it isn't working for me. I'm running 18.3 Cinnamon with OpenJDK 8
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
_zac

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

Post by _zac »

Awesome. Thanks for all the help guys.
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

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

Post by phd21 »

Hi zac, and anyone else,

FYI: In addition to the great link from "xenopeek" on using java, there are some other things to consider.

Linux Mint can run most Java applications very well, but some Java applications will only run with Oracle's Java runtime and others will only run with OpenJDK Java (open source Java usually installed in Linux Mint) by just right clicking the "jar" file and selecting "open with" and pick which Java runtime to use (you might have to check for permission to run (execute) the jar file). I always install and make sure that both the OpenJDK Java 8 and Oracle's Java 8 runtimes are installed, just in case.

...
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
User avatar
karlchen
Level 23
Level 23
Posts: 18209
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

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

Post by karlchen »

Hi, _zac.
_zac wrote: Sun Feb 25, 2018 12:24 pmAwesome. Thanks for all the help guys.
Being sarcastic does not provide a more detailled explanation of what you did exactly and what exactly does not work.
As phd21 has already mentioned, it is imaginable that you try to run a .jar file which does not work under OpenJdk.

So the first thing which we need is the name of the .jar file which you try to run.
The next thing would be running the same command, which Nemo would run on right click, in the terminal and see what happens.
/usr/bin/java -jar /full/path/to/jarfile.jar
In case it works from the commandline, it should work through Nemo as well.
In case the commandline fails, it will not work when invoked by Nemo, either.

Regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
User avatar
karlchen
Level 23
Level 23
Posts: 18209
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

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

Post by karlchen »

Addendum:

It should even be a tiny little bit easier than explained by xenopeek. At least it was one my system here, where I had never bothered to instruct Nemo to open .jar files with a particular application.
xenopeek wrote: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.
Right clicked on a .jar file. Selected "Open With Other Application". The next box offerend me a list of available applications, one of which was labelled "OpenJDK Java 8 Runtime". Selected it. Confirmed. And surprise, the Java application came up.

Checked the corresponding commandline behind it. It read: /usr/bin/java -jar /opt/MSGViewer-1.9/MSGViewer.jar

So, _zac, in case you should be monitoring this thread, it should work. In case it does not, please, verify every single of your steps. One will be incorrect.
In case you are no longer monitoring your thread, well, maybe it will help someone else. :)
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
Locked

Return to “Software & Applications”