[Solved] Access restriction: The type ‘JPEGCodec’ is not API (restriction on required library …

Error:

Access restriction: The type ‘JPEGCodec’ is not API (restriction on required library …

Another error on the Internet (not yet encountered)

To process images in MyEclipse, two packages need to be introduced.
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
Error:
Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt. jar

 

Solution at this point.
Eclipse has set these restricted APIs to ERROR by default, just change the Forbidden references(access rules) in the Deprecated and restricted APIs in Windows-Preferences-Java-Complicer- Errors/Warnings. If you select the Forbidden references (access rules) in the Deprecated and restricted API in Windows-Preferences-Java-Complicer/Warnings as Warning, you can compile it.

Similar Posts: