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!

13 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 !!!

  • G

    Reply to bravo’s:
    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 !!!
    Right click .jar file, click permissions, and make sure “allow running as executable” is selected

  • [...] you can't "convert" it, you'd need to write a deb package from scratch for it, but as it's just one measly file, why bother?? if it's just for YOU then you'll be making an obscene amount of work for just about zero benefit, and seeing as the net result of "installing" it would merely be to put in in a given location, just do it manually. You'll have made your lot no easier whatsoever. I presume that this is more useful… http://alexsleat.co.uk/2010/06/07/ho…les-in-ubuntu/ [...]

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>