问 :import sun.management.ManagementFactory,我在rt包下已经找到sun.management.ManagementFactory,但就是有错,请问怎么回事。

答:Eclipse默认将这些受访问限制的API设成了Error。
解决方法:
只要将Windows---Preferences---Java--Complicer---Errors/Warings里面的Deprecated and restricted API中的Forbidden references(access rules) 选为Waring就可以编译过了。

 

在编写代码时,突然出现:Access restriction: The type Launcher is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar错误,解决办法,在java build path中先移除jre system library,然后重新将jre system library重新add进来。===========》这样也解决了!!!!

 

 

相关文章:

  • 2022-01-06
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-01-17
  • 2021-05-24
猜你喜欢
  • 2021-07-10
  • 2022-01-23
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2021-09-10
相关资源
相似解决方案