`
java-mans
  • 浏览: 11422020 次
文章分类
社区版块
存档分类
最新评论

MyEclipse import com.sun.image.codec.jpeg.JPEGCodec 错误处理办法

 
阅读更多

问题:import com.sun.image.codec.jpeg.JPEGCodec 出现错误

在Java中处理图片,需要引入两个包:

import com.sun.image.codec.jpeg.JPEGCodec;

importcom.sun.image.codec.jpeg.JPEGImageEncoder;

但是发现会报错,错误信息如下:

Access restriction: The typeJPEGImageEncoder is not accessible due to restriction on required library H:/Programfiles/Java/jdk1.6.0_24/jre/lib/rt.jar

解决办法:

MyEclipse默认把这些受访问限制的API设成了ERROR,只要设置一下就OK了。


设置方法如下:

Windows------->Preferences------->Java------->Complicer------->Errors/Warnings里面的Deprecatedand restricted AP------->Forbidden references(access rules) ------->选为Warning------->出现询问是否重新编译的对话框------->点击确认------->编译通过。

如图:



参考资料:http://blog.csdn.net/oney139/article/details/6539624


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics