问题: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------->出现询问是否重新编译的对话框------->点击确认------->编译通过。

如图:

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

相关文章:

  • 2021-10-23
  • 2021-07-25
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
相关资源
相似解决方案