Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I setup Unity to right-click-open a java file? I have tried to "set the default action" but the action is not listed and I cannot add an action from the menus. When I right-click-properties then click the "open with" tab, the "add" button is greyed out.

I write alot of java software. I need the ability to open it from the Desktop.

share|improve this question
Can anyone help me? – AdamOutler Apr 1 '12 at 14:43
up vote 1 down vote accepted

Open /usr/share/applications and look for a file named "OpenJDK Java 6 Runtime". If it doesn't exists create a file named /usr/share/applications/openjdk-6-java.desktop with the following contents:

[Desktop Entry]
Name=OpenJDK Java 6 Runtime
Comment=OpenJDK Java 6 Runtime
Exec=cautious-launcher %f /usr/lib/jvm/java-6-openjdk-i386/bin/java -jar

You should change the "/usr/lib/jvm/java-6-openjdk-i386/bin/java" part of Exec to the location of java on your system. Then reboot and the option should be there.

share|improve this answer
It suddenly came back on its own when 12.04 came out. – AdamOutler May 5 '12 at 19:23

14.04 LTS user here. Got OpenJDK working from desktop with:

contents of /usr/share/applications/openjdk-7-java.desktop

[Desktop Entry]
Name=OpenJDK Java 7 Runtime
Comment=OpenJDK Java 7 Runtime
Exec=cautious-launcher %f /usr/lib/jvm/java-7-openjdk-amd64/bin/java -jar 
share|improve this answer

Your Answer


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.