Can't Execute jar files

34,130

Solution 1

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.

Solution 2

Right click - properties Click on the "Permissions" tab and make sure the "Allow executing file as program" checkbox is checked.

Solution 3

You can also use terminal;

java -jar /home/al0s/Downloads/asd.jar

without installing new things.

Solution 4

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.

Solution 5

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):

  1. Right-click on the jar you want to open and select Properties.
  2. Click File Type Options, under the Type section.
  3. Click Add under the Application Preference Order and search jar.
  4. Select the result, jar, in the dropdown menu and click OK.
  5. Click jar in the Application Preference Order list and click Edit.
  6. Go to the Application tab and enter java -jar as the command.
  7. OK out of everything and you should now be able to double-click any jar to open it.
Share:
34,130

Related videos on Youtube

IutbaZion
Author by

IutbaZion

Updated on September 18, 2022

Comments

  • IutbaZion
    IutbaZion over 1 year

    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).

  • Ian
    Ian almost 9 years
    I believe he said he'd tried that already.
  • Grass the Dinosaur
    Grass the Dinosaur almost 9 years
    @IanLantzy, I thought the OP said that they reinstalled the one that they downloaded beforehand - not mentioning a downgrade, as I suggested.
  • Ian
    Ian almost 9 years
    My bad, for some reason I read the bolded text as just uninstalling and reinstalling openjdk 6 and 7.
  • Grass the Dinosaur
    Grass the Dinosaur almost 9 years
    No problemo =3 I read things (especially commands) wrong every now and then.
  • IutbaZion
    IutbaZion almost 9 years
    Ty i did something similar, i just installed jdk8 runtime, now i can execute Jar files :D
  • Grass the Dinosaur
    Grass the Dinosaur almost 9 years
    @lutbaZion No problemo! ;)
  • lordparthurnaax
    lordparthurnaax almost 6 years
    Already had OracleJDK installed, its great to see a solution without any additional installation.
  • Dharmendrasinh Chudasama
    Dharmendrasinh Chudasama over 5 years
    sorry, my mistake, it should +555 or +777
  • Dharmendrasinh Chudasama
    Dharmendrasinh Chudasama over 5 years
    no prob, right click on sh file, Properties > Permissions > check Allow execution..
  • Dharmendrasinh Chudasama
    Dharmendrasinh Chudasama over 5 years
    it's nothing but just give rights for execution
  • Dharmendrasinh Chudasama
    Dharmendrasinh Chudasama over 5 years
  • David Tabernero M.
    David Tabernero M. over 5 years
    I always forget about giving x permissions. Solved! Thank you! (not sarcasm)