← Back to team overview

openjdk team mailing list archive

[Bug 1727002] [NEW] lib/jrt-fs.jar is incompatible with Java 8

 

Public bug reported:

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)

** Affects: openjdk-9 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug artful wayland-session

** Attachment added: "ReadJrt.java"
   https://bugs.launchpad.net/bugs/1727002/+attachment/4992324/+files/ReadJrt.java

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-9 in Ubuntu.
https://bugs.launchpad.net/bugs/1727002

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

Status in openjdk-9 package in Ubuntu:
  New

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-9/+bug/1727002/+subscriptions


Follow ups