import com.sun.image.codec.jpeg.JPEGImageEncoder error solution

When writing a Java Web program today, when processing JPEG images, you need to import the two packages com.sun.image.codec.jpeg.JPEGImageEncoder and com.sun.image.codec.jpeg.JPEGCodec, and the following error is reported after importing:

 

Access restriction: The type 'JPEGImageEncoder' is not API (restriction on required library 'E:\MyEclipse 2015\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45\jre\lib\rt.jar')

 

      Reason analysis: MyEclipse treats these restricted access APIs as errors by default

 

      Solution: Click Window——>Preferences——>Java——>Compiler——>Errors/Warnings in MyEclipse, expand Deprecated and restricted API, change the Error of the option behind Forbidden reference(access rules) to Warning, the problem It can be solved, as shown in the following figure:



 

Reprinted from: https://blog.csdn.net/u013149325/article/details/44838283

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325969088&siteId=291194637