解決:JPEGImageEncoder編譯問題

iteye_13960發表於2013-12-18
解決:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
 
在Eclipse中處理圖片,需要引入兩個包:
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
報錯:
Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar


此時解決辦法:
Eclipse 預設把這些受訪問限制的API設成了ERROR。
只 要把Windows-Preferences-Java-Complicer- Errors/Warnings裡面的Deprecated and restricted API中的Forbidden references(access rules)選為Warning就可以編譯通過。

相關文章