錯誤1:
java compiler level does not match the version of the installed java project face
解決方法:
右鍵項目“Properties”,在彈出的窗口左側,單擊“MyEclipse"->“Project Facets”,打開“Project Facets”頁面.在頁面中的“Java”下拉列表中,選擇相應版本就OK了。如下圖
報錯2,也可能在import前面報警告warnning:
Access restriction: The type JPEGImageEncoder is not accessible due to restriction
解決方法:
Project -> Properties -> libraries,
先remove掉JRE System Library,然後再Add Library重新加入。
============================================
在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