來自於:http://hi.baidu.com/laife4/blog/item/7ca3e322db2ee3429822ed97.html
在Eclipse中處理圖片,需要引入兩個包:
import com.sun.p_w_picpath.codec.jpeg.JPEGCodec;
import com.sun.p_w_picpath.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就可以編譯通過。