OpenJDK 7/8 don't generate .desktop needed by nautilus

Bug #1448548 reported by Michael William Le Nguyen on 2015-04-25
38
This bug affects 7 people
Affects Status Importance Assigned to Milestone
openjdk-7 (Ubuntu)
High
Unassigned
openjdk-8 (Ubuntu)
High
Unassigned

Bug Description

Ubuntu Release: 15.04 Vivid Vervet

Version of Package: 8u45-b14-1

What I Expected to Happen: I expected that in order to install Java on my system, I could simply run:
sudo apt-get install openjdk-8-jre OR sudo apt-get install openjdk-8-jdk
I also expected that it would automatically generate a .desktop file inside of /usr/share/applications in order to set OpenJDK as the default way of opening .JAR files.

What Happened Instead: Java installs just fine. However, if I try to set OpenJDK as the default for opening .JAR files, there is no entry for OpenJDK in the "Default Applications" list (under Right Click > Properties > Open With). That meant that I had to manually navigate to /usr/share/applications in Terminal and manually create an openjdk-8-java.desktop file containing:
[Desktop Entry]
Name=OpenJDK Java 8 Runtime
Comment=OpenJDK Java 8 Runtime
Exec=java -jar %u
Terminal=false
Type=Application
Icon=openjdk-8
Mimetype=application/x-java-archive;application/java-archive;application/x-jar;
NoDisplay=false

Related branches

affects: openjdk-7 (Ubuntu) → openjdk-8 (Ubuntu)
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-8 (Ubuntu):
status: New → Confirmed
Josep Pujadas-Jubany (jpujades) wrote :

Ubuntu 12.04 LTS (32 & 64 bit) up-to-date
Lubuntu 14.04 LTS (32 & 64 bit) up-to-date

No openjdk-7-java.desktop file at /usr/share/applications

However, jar files are associated to openjdk-7-java.desktop at /usr/share/applications/defaults.list & /usr/share/applications/mimeinfo.cache

At Ubuntu 12.04 LTS (32 & 64 bit) up-to-date file openjdk-6-java.desktop exists.

Workaround. Create /usr/share/applications/openjdk-7-java.desktop similar to /usr/share/applications/openjdk-6-java.desktop

The contents should be:

[Desktop Entry]
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

Many people are claiming for this problem. Yo u can search it at Google:

missing openjdk-7-java.desktop

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-7 (Ubuntu):
status: New → Confirmed
Changed in openjdk-7 (Ubuntu):
status: Confirmed → New
Josep Pujadas-Jubany (jpujades) wrote :

/usr/share/applications/mimeinfo.cache has a line:

application/x-java-archive=file-roller.desktop;

and should be:

application/x-java-archive=openjdk-7-java.desktop;file-roller.desktop;

In fact, in a 12.04 LTS system with openjdk-6-java.desktop the line is:

application/x-java-archive=openjdk-6-java.desktop;file-roller.desktop;

I don't know if it is a bug or somebody decided not to permit the double-click for java files.

Josep Pujadas-Jubany (jpujades) wrote :

Changes at /usr/share/applications/mimeinfo.cache for double-click didn't work. I had to fix ~/.local/share/applications/mimeapps.list

[Added Associations]
application/x-java-archive=openjdk-7-java.desktop;

[Default Applications]
application/x-java-archive=openjdk-7-java.desktop

This can be done using [Open with] at file propierties or adding the "application" lines with a text editor.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-7 (Ubuntu):
status: New → Confirmed
tags: added: rls-w-incoming
Sebastien Bacher (seb128) wrote :

that was changed in http://bazaar.launchpad.net/~openjdk/openjdk/openjdk7/revision/586

" * Only install the openjdk-java.desktop file when using cautious-launcher."

Unsure what "cautious-launcher" is though

summary: - OpenJDK 8 Apt-Get Install Doesn't Generate openjdk-8-java.desktop File
+ OpenJDK 7/8 don't generate .desktop needed by nautilus
Changed in openjdk-7 (Ubuntu):
importance: Undecided → High
Changed in openjdk-8 (Ubuntu):
importance: Undecided → High
Marc Deslauriers (mdeslaur) wrote :

cautious-launcher is an Ubuntu-specific helper that ensures .jar files have the required executable bit set in order to comply with the following:

https://wiki.ubuntu.com/SecurityTeam/Policies#Execute-Permission_Bit_Required

The problem with openjdk is with this section in the rules file:

# .desktop files need to be multiarch installable
java_launcher = /$(basedir)/bin/java
java_launcher = /usr/bin/java
ifeq ($(distribution),Ubuntu)
  ifeq (,$(filter $(distrel),karmic jaunty intrepid hardy))
    java_launcher = cautious-launcher %f /$(basedir)/bin/java
    java_launcher = cautious-launcher %f /usr/bin/java
  endif
endif

I'm not sure why java_launcher is getting set twice, and I'm not sure why we're limiting cautious-launcher to older ubuntu releases.

Marc Deslauriers (mdeslaur) wrote :

Actually, I've read that wrong. I think the issue is the comparison here:

ifeq ($(java_launcher),cautious-launcher)

Matthias Klose (doko) on 2015-08-13
Changed in openjdk-8 (Ubuntu):
status: Confirmed → Fix Committed
Matthias Klose (doko) on 2015-08-13
Changed in openjdk-7 (Ubuntu):
status: Confirmed → Fix Committed
Bruno Nova (brunonova) wrote :

I bumped on this bug today in Trusty.
Both Java 7 from the official repositories and Java 8 from ppa:openjdk-r/ppa are missing the .desktop file.

I hope to see a fix in Trusty soon.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-7 - 7u85-2.6.1-1ubuntu1

---------------
openjdk-7 (7u85-2.6.1-1ubuntu1) wily; urgency=medium

  * Stop building zero on AArch64, broken on the merged IcedTea Hotspot.

 -- Matthias Klose <email address hidden> Thu, 03 Sep 2015 20:31:02 +0200

Changed in openjdk-7 (Ubuntu):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-8 - 8u66-b01-2ubuntu1

---------------
openjdk-8 (8u66-b01-2ubuntu1) wily; urgency=medium

  * Build using GCC 4.9 on armhf and powerpc.

 -- Matthias Klose <email address hidden> Sat, 05 Sep 2015 16:06:38 +0200

Changed in openjdk-8 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers