在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 ...\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就能夠編譯經過。
ui