hi , I used to right click on a .jar file and select " open with openjdk " from the option menu , last night my computer was updated ,openjdk version 7 is installed but that option is no longer there when I right click on the .jar file , it is not even listed in the " open with " menu but when I type java -jar file.jar in the terminal it works . how can I get back that option in the menu

Two possible ways of doing this:

  1. edit your menu settings from within your DM settings menu, or
  2. within IcedTea control panel, check appriopriate box that triggers showing "Open with JDK" in context menus. In KDE it looks moreless like this:
    snapshot1.png

HTH

none of the above works

Hi! If using Ubuntu then open the terminal and type:

locate java.desktop

It should find few entries under /usr/share/app-install/desktop/, these are the files used to generate the desktop entries. If you don't get results try to update the mlocate database through the command updatedb. If you get some results the one you need is:

openjdk-7-jre\:openjdk-7-java.desktop

So open the mimeapps.list file in your profile:

leafpad ~/.local/share/applications/mimeapps.list

And add this line:

application/jar=openjdk-7-jre\:openjdk-7-java.desktop;

The format is simple: mime-type = app.desktop. Then if the option does not appear, create a shortcut in ~/.local/share/applications/:

ln -s /usr/share/app-install/desktop/openjdk-7-jre\:openjdk-7-java.desktop ~/.local/share/applications/.

And then it should work. If this does not help then you have to manually create a .desktop file, these are the contents of mine:

[Desktop Entry]
X-AppInstall-Package=openjdk-7-jre
X-AppInstall-Popcon=7303
X-AppInstall-Section=main

Name=OpenJDK Java 7 Runtime
Comment=OpenJDK Java 7 Runtime
Exec=cautious-launcher %f /usr/bin/java -jar
Terminal=false
Type=Application
Icon=openjdk-7
MimeType=application/x-java-archive;application/java-archive;application/x-jar;
NoDisplay=true

X-Ubuntu-Gettext-Domain=app-install-data

Hope it helps, bye!

thank you , it worked after creating the shortcut in ~/.local/share/applications/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.