I'm trying to run a jar application under Ubuntu, so I installed OpenJDK Java 7 Runtime, but when I open this application I got this message :

The file '/home/aimad/Programms/jMerise/JMerise.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.

5 Answers 5


You can always run a jar file by doing java -jar JMerise.jar.

However, to make the jar file itself executable, you need to set the executable bit, as the message hints. chmod +x /home/aimad/Programms/jMerise/JMerise.jar will accomplish this.

After that you can do ./JMerise.jar to run it.

man chmod will provide you with information about how chmod works.

Also see: https://wiki.ubuntu.com/Security/ExecutableBit

  • 1
    Did this ever work? bash: ./bbb.jar: cannot execute binary file: Exec format error for file bbb.jar -> bbb.jar: Java archive data (JAR)
    – Harald
    Mar 19 at 10:04

Right click on the file, click on properties, then go to the Permissions tab, and check the box that says "Allow executing this file as a program".

enter image description here

  • What about if I can't check that box above, to "allow executing file as a program"? I do check it, but a moment later it automatically gets unchecked!
    – user961627
    Dec 3, 2014 at 8:37
  • @user961627 You probably have the .jar file stored on a partition which doesn't support the executable bit. See Can't make a file executable for more details.
    – wjandrea
    Aug 22, 2017 at 20:08

Since you run your jar application with java -jar application.jar then that means java is on your path. You need two simple things: 1) add an interpreter (which apparently is #!java -jar) in the first line of your jar file jut like you do that with your shell scripts: echo '#!java -jar' > app.jar cat application.jar >> app.jar mv app.jar application.jar

If you cat the contents of your jar file you'll see it starts with ex.: #!java -jar PK ^lN BOOT-INF/PK ..... ..... 2) add execute attribute by chmod +x application.jar Now you are able to "self-run" it via ./application.jar.


First you'll need to make sure you have a suitable Java runtime environment on your system. Ubuntu has openjdk in the official repo which is 99.99% combatible with Oracle Java, to install it type:

sudo apt-get install openjdk-7-jre

Next create a file called java-jar-launcher.desktop in ~/.local/share/applications and put the following contents in it:

[Desktop Entry]
Name=Java Application Launcher
Exec=/usr/bin/java -jar %U

Next add the following line in ~/.local/share/applications/mimeapps.list:


Now you should be able to just double click jar files to launch them, if nothing happens then right click on a jar file, select properties then go to the "Open With" tab and there you should see "Java Application Launcher", select that.

This method is prefferable (IMHO) because this way you are not giving execute permissions to jar files which can be potentially dangerous. This method will only work in a graphical environment and needs the user to manually double click on the file.


If running a .jar file from the command line works (java -jar myFile.jar), but double-clicking it in the GUI does not, and if sudo chmod +x myFile.jar appears to succeed but you still can't open with double-click, and if right-clicking the .jar file > Properties > Permissions > "Allow executing file as program" does not work (i.e., the checkbox switches back just after you click it), then probably the .jar file is on an NTFS file system, which does not allow execute permissions on a per-file basis. (You may have this problem if you dual-boot, for example, and have a shared NTFS partition between Ubuntu and Windows).

Creating a launcher (as @tusharkant15 describes) will work because behind the scenes you're executing /usr/bin/java, not the .jar file itself. Moving the .jar file to some other file system that is not NTFS will also work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .