lib/jrt-fs.jar is incompatible with Java 8

Bug #1727002 reported by trespasserw
142
This bug affects 27 people
Affects Status Importance Assigned to Milestone
openSUSE
Won't Fix
Medium
openjdk-9 (Debian)
Fix Released
Unknown
openjdk-9 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

A program running on Java 8 should be able to use the library to peek inside Java 9 (JEP 220 "Modular Run-Time Images" [1], section "New URI scheme ...").

Steps to reproduce:
1. Download an attached program
2. `apt install openjdk-8-jdk openjdk-9-jdk`
3. `/usr/lib/jvm/java-8-openjdk-amd64/bin/javac ReadJrt.java`
4. `/usr/lib/jvm/java-8-openjdk-amd64/bin/java ReadJrt /usr/lib/jvm/java-9-openjdk-amd64`

Expected result:
The program lists root directories of a runtime image (/packages, /modules) and finishes normally.

Actual result:
The program fails with the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
 at jdk.internal.jimage.BasicImageReader.slice(BasicImageReader.java:211)
 at jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:218)
 at jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:152)
 at jdk.internal.jimage.ImageReader$SharedImageReader.<init>(ImageReader.java:224)
 at jdk.internal.jimage.ImageReader$SharedImageReader.open(ImageReader.java:238)
 at jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
 at jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
 at jdk.internal.jrtfs.SystemImage.open(SystemImage.java:59)
 at jdk.internal.jrtfs.JrtFileSystem.<init>(JrtFileSystem.java:90)
 at jdk.internal.jrtfs.JrtFileSystemProvider.newFileSystem(JrtFileSystemProvider.java:108)
 at java.nio.file.FileSystems.newFileSystem(FileSystems.java:336)
 at ReadJrt.main(ReadJrt.java:33)

Probable reason:
Classes in lib/jrt-fs.jar were compiled by Java 9 with options "-source 8"/"target 8". They should be compiled with "--release 8" option instead (or by Java 8).

[1] http://openjdk.java.net/jeps/220

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: openjdk-9-jre-headless 9~b181-4
ProcVersionSignature: Ubuntu 4.13.0-16.19-generic 4.13.4
Uname: Linux 4.13.0-16-generic x86_64
ApportVersion: 2.20.7-0ubuntu3
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue Oct 24 20:06:01 2017
InstallationDate: Installed on 2017-09-29 (25 days ago)
InstallationMedia: Ubuntu 17.10 "Artful Aardvark" - Alpha amd64 (20170926)
SourcePackage: openjdk-9
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
trespasserw (trespasserw) wrote :
Revision history for this message
trespasserw (trespasserw) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in openjdk-9 (Ubuntu):
status: New → Confirmed
Revision history for this message
In , k463 (k463) wrote :

The `jrt-fs.jar` shipped in `java-9-openjdk-headless` package is not compatible with Java 8, which is apparently necessary for some development tools that themselves run on Java 8 to be able to use the Java 9 JDK shipped in this package.

One example of this is Intellij IDEA, which means currently it's unable to use openSUSE provided Java 9 JDK as a project JDK.

A detailed explanation of the issue can be found on OpenJDK bugtracker [1] and also a test program and steps to reproduce can be found on Ubuntu bugtracker for their corresponding package [2].

The steps are:

1. zypper in java-9-openjdk-headless java-1_8_0-openjdk-headless
2. download `ReadJrt.java` from [2]
3. /usr/lib64/jvm/java-1.8.0/bin/javac ReadJrt.java
4. /usr/lib64/jvm/java-1.8.0/bin/java ReadJrt /usr/lib64/jvm/java-9/

[1] https://bugs.openjdk.java.net/browse/JDK-8174808
[2] https://bugs.launchpad.net/ubuntu/+source/openjdk-9/+bug/1727002

Revision history for this message
k463 (k463) wrote :

Also relevant bug in Intellij IDEA: https://youtrack.jetbrains.com/issue/IDEA-179481

Revision history for this message
In , k463 (k463) wrote :

Also relevant bug in Intellij IDEA: https://youtrack.jetbrains.com/issue/IDEA-179481

Changed in opensuse:
importance: Unknown → Medium
status: Unknown → Confirmed
Changed in openjdk-9 (Debian):
status: Unknown → New
Changed in openjdk-9 (Debian):
status: New → Fix Released
Revision history for this message
In , Postadal (postadal) wrote :

close

Changed in opensuse:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.