When developing JAVAT programs in Eclipse to process images, two packages need to be introduced:
import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder;
But sometimes an error will be reported when introducing these two packages:
Access restrictions: The type JPEGImageEncoder is not accessible due to restriction on required library C:/Java/jre1.6.0_07/lib/rt.jar
The main reason for this error is the access restriction problem in Eclipse, which can be solved by the following two methods:
1. Global attribute preferences>java>Compiler>Errors/Warnings>Set the "Deprecated and restricted API>Forbidden reference Error" on the right to "Warning".
2. Project properties preferences>java build path>Delete the JRE System Library in libraries on the right and re-import it.
Both of the above methods can solve the problem of Eclipse's introduction of com.sun.image.codec.jpeg error. If the problem cannot be solved, please contact us