Search code examples
javanoclassdeffounderrorjava-9

Which classes are removed in Java 9? Get NoClassDefFoundError on Java 9. Java 8 work


What classes were removed in Java 9?

On Java 8 my tool is working.

On Java 9 I get:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGCodec

It seems that some classes have been removed.

I use the Oracle JDK on Windows.


Solution

  • The JDK 9 release note and The one for removed features.

    They said

    client-libs/2d Remove the com.sun.image.codec.jpeg package com.sun.image.codec.jpeg has been shipped as a non-standard API since JDK 1.2. It was always advertised as a stop-gap measure until a proper standard equivalent was provided. That replacement (javax.imageio) has been there since JDK 1.4. As a result JDK 9 finally removes the long deprecated com.sun.image.codec.jpeg API which has been flagged as intended for removal for several releases. Applications which still depend on it will need to be re-coded in order to run on JDK9. See JDK-8038838