Home > Software design >  BandStructure.java missing upgrading to jdk 11 from jdk 8
BandStructure.java missing upgrading to jdk 11 from jdk 8

Time:12-16

openjdk-8u45-b14\jdk\src\share\classes\com\sun\java\util\jar\pack\BandStructure.java

BandStructure.java is removed in jdk11, I am upgrading to jdk 11 from jdk 8 and the above file is not present in source code of jdk 11. Please suggest any alternative for same

CodePudding user response:

The BandStructure does still exist in Java 11, but the Java compiler module system now makes it harder for application code to depend on JVM internal classes.

The BandStructure class still exists in the OpenJDK codebase up to Java 13 but it is gone in Java 14. Thus class is a component of the old pack200 and unpack200 utilities that were deprecated in Java 11 and removed in Java 14.

Is there a replacement for BandStructure?

Well, in the general sense ... no there isn't. The pack200 and unpack200 commands have been removed from the codebase.

There might be a replacement for your particular use of BandStructure ... but we cannot advise you about that unless you provide more details.


If you desperately wanted to keep using BandStructure in Java 11, you could consider using --add-exports etcetera as described in JEP 261. However, this is only putting off the problem until later. By Java 14, the class is completely gone.


Note that it was always a bad idea to write applications that depended on internal classes from com.sun.* packages. The documentation has always warned that such classes could be changed or removed. In this case, it has happened.

CodePudding user response:

Pack200 gone

The Pack200 feature was removed in Java 14. Thus your missing class.

See JEP 367: Remove the Pack200 Tools and API.


To avoid these surprises, I suggest:

  • Reading the release notes for every version of Java
  • Compiling and testing with each non-LTS version of Java
  • Related