MyEclipse中JPEGImageEncoder和JPEGCodec报错以及解决办法

Eclipse默认把这些受访问限制的API设成了ERROR。

只要把Windows-Preferences-Java-Complicer-Errors/Warnings里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning

并在开头导入相应的包:import com.sun.image.codec.jpeg.JPEGCodec;
                                     import com.sun.image.codec.jpeg.JPEGImageEncoder;

即可以解决此问题。

猜你喜欢

转载自blog.csdn.net/h2503652646/article/details/82468822