引用报错——利用java获取计算机cpu利用率和内存使用信息
失忆的鱼 2013-06-29 11:27:55 想用java获取计算机cpu利用率和内存使用信息,看了好多方法,里面都有这两个关键引用,但我一引用就报错,求解决方法
import sun.management.ManagementFactory;
import com.sun.management.OperatingSystemMXBean;
错误1:import sun.management.ManagementFactory;
The type sun.management.ManagementFactory is not visible
错误2:import com.sun.management.OperatingSystemMXBean;
Access restriction: The type OperatingSystemMXBean is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\rt.jar