Ask Your Question

How do I launch .jar files using nautilus?

asked 2011-11-28 15:02:20 -0600

draxx gravatar image

updated 2011-11-28 19:02:45 -0600

FranciscoD_ gravatar image


My system is Fedora 16 and I have openjdk 1.7 installed on it. I could launch .jar files in the terminal but I cannot launch .jar files in Nautilus by double clicking on it. The current behaviour open fileroller and I cannot find openjdk in the list of applications...

How can I execute .jar file in nautilus and associate openJdk to .jar files in Nautilus?

Thank you.

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2012-10-08 10:26:56 -0600

alick gravatar image

updated 2012-10-08 10:30:05 -0600

I ran into the same problem and end up with a solution by xdg mime. It is not Nautilus specific, and will work in more tools(like other file manager, xdg-open in cli etc).

Create a run-jar.desktop in your ~/.local/share/applications/ directory with the following content:

[Desktop Entry]

Exec=java -jar %f

Comment=Run the jar file
Comment[zh_CN]=运行 JAR 文件

Now when you open the file's property dialog and go to open with tab, you can see run-jar mentioned in 'show more app'.

To make run-jar the default action, use nautilus 'set default' button or the type the following command in a terminal:

xdg-mime query default application/x-java-archive

(The mime type can be found with the command xdg-mime query filetype my_shiny_app.jar.)

edit flag offensive delete link more


Agreed - great solution. I prefer this to the script workaround above.

pds gravatar imagepds ( 2013-03-20 06:11:32 -0600 )edit

It is good to have a way to make the computer behave. But I'd really like to know where this information is stored, ie. which configuration file? Right now I want to change how *.sgf files open. I tried both of the following:

gsettings list-recursively | fgrep -i sgf

dconf dump / | fgrep -i sgf

Neither returned anything at all. (Fedora 28 Workstation)

nobrowser gravatar imagenobrowser ( 2018-12-12 20:21:13 -0600 )edit

answered 2011-11-29 00:22:06 -0600

Write a nautilus script

cd ~/.gnome2/nautilus-scripts

Make a file, call it jar, or any name you wish, (with gedit, vim, or your editor of choice)


java -jar $1

Make the file executable

chmod u+x ~/.gnome2/nautilus-scripts/jar

Now in nautilus right click your file -> scripts -> jar

Just be sure $HOME is not mounted noexec ;)

edit flag offensive delete link more


I agree it is a bug, glad the work around was helpful

bodhi.zazen gravatar imagebodhi.zazen ( 2011-11-29 15:08:54 -0600 )edit

answered 2011-12-12 19:26:12 -0600

Viroscope gravatar image

updated 2013-06-05 17:51:26 -0600

You can create your own MIME type I posted a how-to on my page because I needed to be able to execute .jar files and didn't want to have to open a terminal everytime.

This how-to is how I made .jar files run on a double click instead. All because I like to use TED.jar :)

My website http: //viros-mind.blogspot. com/2011/12/make-jar-files-execute-from-file.html

But this makes the .jar file association recognized throughout gnome.

P.S. This makes Java show up in the file association too.

edit flag offensive delete link more

answered 2011-11-28 15:25:55 -0600

Try changing the default action in nautilus. Right click on the .jar file, choose Properties, choose Open With, click Add, click Use a custom command, and type in xterm -e java -jar

edit flag offensive delete link more


I can confirm this behavior. @draxx, I really think you should file a bug. This is loss of functionality. :/

FranciscoD_ gravatar imageFranciscoD_ ( 2011-11-28 19:01:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2011-11-28 15:02:20 -0600

Seen: 10,924 times

Last updated: Jun 05 '13