How to open jar file using open JDK?
I installed "open jdk 7" on ubuntu 13.04, but not recognized in "other application" list to set as default. I need to open a ".jar" file with "open jdk7". Please help.
Solution 1:
1. First you need to have installed java. Can install from Software Center or by following command in terminal. (Open terminal with pressing Ctrl+Alt+T ).
sudo apt-get install openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless
2. Right click on the .jar file and select Open With Openjdk Java 6/7 Runtime
** If there is no Open With Openjdk Java 6/7 Runtime
option in menu, then select Open with
and then select Openjdk Java 6/7 Runtime
** If it is not even in the Open with
then select Other Aplication...
and select Openjdk Java 6/7 Runtime
** If it is even not found here, then select Show other apllications
Button. Here you can select Openjdk Java 6/7 Runtime
** If it is not even in Show other apllications
list, you need to done something in Terminal
i. Open terminal with pressing Ctrl+Alt+T .
ii. Paste this in terminal prompt and Enter.
gksudo gedit '/usr/share/applications/openjdk-7-java.desktop'
iii. In the resulting gedit document, Change the NoDisplay=true
line to NoDisplay=false
: then save the file and close it.
iv. Then you will able to find Openjdk Java 6/7 Runtime
in any of the above Open with
menu.
3. Another method is to create a Desktop icon to launch this .jar file application. To do that :
i. In terminal run gksudo gedit /usr/share/applications/[NAME OF THE APPLICATION].desktop
** Replace the [NAME OF THE APPLICATION]
with .jar file name.
iI. Add the following lines to the resulting empty gedit. Replace the text in [ ]
with appropriate. Then save it and close.
[Desktop Entry]
Encoding=UTF-8
Name=[APPLICATION NAME]
Comment=[WHAT EVER]
Exec=java -jar [DIRECTORY OF THE FILE]/[FILE NAME.JAR] %F
StartupNotify=true
Terminal=false
Type=Application
Icon=/usr/share/icons/gnome/256x256/apps/[ANY ICON YOU LIKE IN THIS FOLDER]
NoDisplay=false
MimeType=applications/php
iii. You will able to find the icon for this application in Dash. You can open the .jar
file application by click on it.