HowTo: Run .jar files in Ubuntu

To run a JAR file from the command line in ubuntu using the following command:

java -jar filename.jar

Otherwise it is also possible to enable double clicking to run jar files too by the following simple steps:

  1. Find the .jar file in the File Browser (a.k.a Nautilus)
  2. Right click the .jar file > Properties
  3. Click on the “Open With” tab along the top
  4. Change the bullet to be Sun Java 6 Runtime
  5. Click Close and you’re done.

Now you should be able to just double click the file and it will run just like most other files!

Related posts:

  1. HowTo: Fix Jumping/Skipping Sound in Spotify under Wine – Ubuntu Karmic (9.10)
  2. Howto: Reinstall Grub using Ubuntu Live CD
  3. HowTo Fix: The file ‘/path/file.exe’ is not marked as executable.
  4. HowTo: Install Player/Stage in Ubuntu Karmic (9.10)
  5. HowTo: Switch the Window Menu Buttons Back to the Right – Ubuntu 10.04 / 10.10 / 11.04

11 comments to HowTo: Run .jar files in Ubuntu

  • Whoo!

    JAR files are awesome!

  • Alex

    hahaha! yes, yes they are :) oh wait this post is fully empty :/ should sort that out

  • Michael

    I do not have a radio button for java 6, but I have installed sun java. How do I get the radio button, or what is the command for a custom command (I know where it’s installed to, but I don’t know what file I need to use)?

  • mc

    Thank you for the info. Just also want to share this other way of opening JAR files. See this http://openjarfile.com

  • Sarbjit

    Simple and to the point talk.
    But my friend you are missing that beside all this one shall have to select the checkbox for ‘Allow executing file as program’ on the ‘Permissions’ tab. Only then a ‘.jar’ file will run by double clicking on it, otherwise it will open in Archive Manager for content browsing.
    This is my personal experience on linuxmint 10 Julia!!

  • eldar

    does it do it on a 32 bit ubuntu

  • ninja246810

    I cant seem to do those steps and cannot locate sun java runtime!

  • Hi I have Ubuntu 9.04.In my case when I open jar file with Sun Java 6 Runtime it doesn’t work.But when I open jar file with OpenJDK Java 6 Runtime it works.

  • peglegwookie

    So simple and so easy, but it still took me upwards of 40 minutes to find your post. Thank you! I will share this with others who want to know by directing them here.

  • Bravo

    Hi I am getting error message:

    The file ‘/home/bravo/NetBeansProjects/Test/dist/Test.jar’ is not marked as executable. If this was downloaded or copied from an untrusted source, it may be dangerous to run. For more details, read about the executable bit.

    Please helpt !!!

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>