0

This question already has an answer here:

BACKGROUND: I went to oracle.com and I downloaded the JDK. I moved the file to /usr/local/java. Afterwards, I set the path variable and JAVA_HOME in /etc/environment.

PROBLEM: I have a jar file in my downloads directory. Although I can go to terminal and use "java -jar" and it works, I want to be able to double click and execute the jar file.

marked as duplicate by muru, karel, Zanna, user.dz, TheWanderer Nov 28 '16 at 12:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Sorry if the question sounds stupid and is obvious, I just installed ubuntu yesterday. – user623965 Nov 27 '16 at 4:27
1
  • Right click on .jar file
  • Select "Properties" tab
  • Select your Java Runtime
  • Press Set as default

enter image description here

Now you can open/execute any .jar file by double clicking them

UPDATE

If you cannot find "OpenJDK" option, maybe you don’t have the runtime environment installed. Use below command to install it.

sudo apt-get install openjdk-8-jre
  • It doesn't show up in the "open with" – user623965 Nov 28 '16 at 4:46
  • @PrinceRajaruban See my edit – Jim Nov 28 '16 at 4:55