Access restriction: The method createJPEGEncoder(OutputStream) from the type JPEGCodec is not access

来源:互联网 发布:软件业务需求分析 编辑:程序博客网 时间:2024/06/06 10:42
准备使用Java进行图片压缩的时候,使用
import com.sun.image.codec.jpeg.*;  

结果出现错误:

Access restriction: The method createJPEGEncoder(OutputStream) from the type JPEGCodec is not accessible due to restriction on required library
上网查了一下,发现是IDE的设置问题,它默认把这些受访问限制的API设成了ERROR

解决方法:

Windows->Preferences->Java->Complicer->Errors/Warnings

将 Deprecated and restricted API 中的 Forbidden references(access rules) 选为Warning就可以了。
0 0
原创粉丝点击