Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a problem running .jar files by double-clicking them. When I go to the Properties dialogue I can't find Java--only Archive Manager in the list of programs. But java -jar somefile.jar opens the program.

share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

Maybe you don’t have the runtime environment installed!

To install it try the following instructions.

sudo apt-get install openjdk-7-jre

Or you could install Oracle JRE using the PPA method with the following commands.

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

Then to use it to open .jar files try the following.

  1. Right click the .jar file > Properties.
  2. Click on the “Open With” tab along the top.
  3. Change the default choice to be Sun Java 6 Runtime.
  4. Click Close and you should be ready to double click.
share|improve this answer
add comment

To make Java open .jar files per default (i.e. double click) right click on any .jar file to select Properties. In the following window select the "Open With" tab to see e.g. the follwing choice:

enter image description here

Select your Java runtime and press Set as default to make this your default application to open .jar files.

share|improve this answer
add comment

Or you can create an *.desktop file!

  • Create a folder in a directory of your choice with the *.jar and *.png files (In this case the directory is /usr/share/folder).
  • Open the terminal and run the following code line:

    sudo gedit /usr/share/applications/*.desktop

  • Paste the following code lines in the file you are editing:

    [Desktop Entry]  
    Encoding=UTF-8  
    Name=Name  
    Categories=Category Name  
    Exec=java -jar /usr/share/folder/*.jar  
    Icon=/usr/share/folder/*.png  
    StartupNotify=false  
    Terminal=false  
    Type=Application  
    Comment=Application Name  
    StartupWMClass=Class 
    
  • Save the file.

(The * is always the same name.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.