import com.sun.image.codec.jpeg.*

后端 未结 6 1013
时光取名叫无心
时光取名叫无心 2020-11-27 16:37

I have a Java program when I compile it I get the following error

[javac] ...\\MyClass.java:33: package com.sun.image.codec.jpeg does not exist
[javac] impor         


        
6条回答
  •  天命终不由人
    2020-11-27 16:58

    In general, try not to use classes from "sun." or "com.sun." packages, as this packages are considered implementation details, and are not part of the Java API.

    They can cause problems when moving to new versions of Java because there is no backwards compatibility guarantee. Similarly, they can cause problems when moving to a different Java vendor, such as OpenJDK.

    Such classes are almost always wrapped by Java API classes that should be used instead.

    See: https://sonarcloud.io/organizations/default/rules?languages=java&open=squid%3AS1191&q=sun

提交回复
热议问题