解決方案1(推薦):
只需要在相應project的build path中先移除JRE System Library,再添加庫JRE System Library,重新編譯後就一切正常了。
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings ->
Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning
原文:http://blog.csdn.net/jbxiaozi/article/details/7351768