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

Dani AI

Generated

After an update the "Open with OpenJDK" entry can vanish even though running a JAR from the terminal still works. The thread shows the common routes: pointed out desktop-environment / IcedTea integration options, and restored the menu by creating a user-level Java launcher and making it available to the file manager (which confirmed fixed the problem).

Why this happens: the file manager builds the "Open with" menu from desktop-launcher metadata plus the system MIME registry. Package updates can move or replace the Java launcher entry, change its metadata so it is hidden from context menus, or alter the MIME database so a .jar is no longer classified as a Java archive. Desktop environments and helper tools (IcedTea integration, file-manager plugins) also influence whether an application appears in the right-click menu.

A safe, practical checklist to complement the existing answers:

  • Verify how the system currently classifies the JAR (file-manager Properties or a MIME check from the shell).
  • Inspect Java runtime launchers in both system and per-user application folders; prefer creating a per-user launcher so package updates won’t overwrite local changes.
  • Ensure the launcher advertises handling of JAR/archive MIME types and that its Exec line accepts a filename argument so file managers will offer it.
  • Refresh the desktop/mime cache or restart the file manager or session after changes.
  • If IcedTea integration is installed, confirm its context-menu option is enabled, as suggested.

Safety note: avoid running unknown JARs directly from the GUI without seeing output. Creating a small per-user launcher is the least invasive fix and preserves system packages. For tricky cases the key pieces of information are the desktop environment in use, which Java runtime is active, and the system-detected MIME type for the JAR — those determine the exact next step.

Recommended Answers

All 4 Replies

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.