无事下载Google的common包guarva玩玩,丢到eclipse中就编译报错:Access restriction: The type Unsafe is not accessible due to restriction on required library C:\Java\jre6\lib\rt.jar

问题原因:Eclipse 默认把这些受访问限制的API设成了ERROR。

解决办法:将Windows->Preferences->Java-Complicer->Errors/Warnings->Deprecated and restricted API,中的Forbidden references(access rules)设置为Warning,即可以编译通过。