I'm having trouble opening jar files because there is no java runtime in open with listed. Even I have installed it via Software Center(i also try to reinstall it via synaptic and i do a --purge via terminal).
6 Answers
Right click - properties Click on the "Permissions" tab and make sure the "Allow executing file as program" checkbox is checked.
-
I always forget about giving x permissions. Solved! Thank you! (not sarcasm) Oct 14, 2018 at 12:12
I just recently had the same problem - the way I fixed it was to uninstall OpenJDK 7 and install OpenJDK 6.
I have no idea why OpenJDK 7 doesn't want to work but it started glitching when I installed it via the Terminal.
Installing OpenJDK 6 is like installing a fresh new version of Java.
I had tried many different other commands and they didn't seem to work.
-
-
@IanLantzy, I thought the OP said that they reinstalled the one that they downloaded beforehand - not mentioning a downgrade, as I suggested. Apr 28, 2015 at 1:59
-
My bad, for some reason I read the bolded text as just uninstalling and reinstalling openjdk 6 and 7.– IanApr 28, 2015 at 2:12
-
No problemo =3 I read things (especially commands) wrong every now and then. Apr 28, 2015 at 2:19
-
Ty i did something similar, i just installed jdk8 runtime, now i can execute Jar files :D May 8, 2015 at 2:32
You can also use terminal;
java -jar /home/al0s/Downloads/asd.jar
without installing new things.
-
Already had OracleJDK installed, its great to see a solution without any additional installation. May 21, 2018 at 6:55
Try this. Open a terminal and try running
java -version
As long as it returns something, you have java installed. You likely haven't marked the .jar files as executable. To do so open a terminal, navigate to where the .jar files are located and run
chmod u+x name-of-file.jar
Replacing name-of-file.jar
with the .jar file you're wanting to run.
I actually had this problem, too. I had Java installed and marked the jar
as executable, but it still didn't work. Here's how I fixed it (kind of a workaround):
- Right-click on the
jar
you want to open and selectProperties
. - Click
File Type Options
, under theType
section. - Click
Add
under theApplication Preference Order
and searchjar
. - Select the result,
jar
, in the dropdown menu and clickOK
. - Click
jar
in theApplication Preference Order
list and clickEdit
. - Go to the
Application
tab and enterjava -jar
as the command. - OK out of everything and you should now be able to double-click any
jar
to open it.
Create sh file in same directory, i am making sample file for jar file "test.jar"
Filename: test.sh
#!/bin/sh
java -jar test.jar
Give rights for execution
chmod +555 test.sh
now you can execute your jar with double click on test.sh, you can make link at another places also of test.sh
-
-
no prob, right click on sh file, Properties > Permissions > check Allow execution.. Sep 18, 2018 at 13:25
-
-