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

后端 未结 6 984
时光取名叫无心
时光取名叫无心 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 17:00

    Why are you using classes in the package com.sun.image.codec.jpeg? You are not supposed to use those classes directly: Why Developers Should Not Write Programs That Call 'sun' Packages.

    What does your program do? Does it just try to read or write a JPG image? That's very easy with the ImageIO API. See this tutorial: Writing/Saving an Image.

    Addition - The package com.sun.image.codec.jpeg has been removed in Java 7 as mentioned in the Java SE 7 and JDK 7 Compatibility Guide.

    Synopsis: The Non-standard com.sun.image.codec.jpeg Package is Retired

    Description: The com.sun.image.codec.jpeg package was added in JDK 1.2 (Dec 1998) as a non-standard way of controlling the loading and saving of JPEG format image files. This package was never part of the platform specification and it has been removed from the Java SE 7 release. The Java Image I/O API was added to the JDK 1.4 release as a standard API and eliminated the need for the com.sun.image.codec.jpeg package.

提交回复
热议问题