无法在java类中导入org.sun.management.OperatingSystemMXBean? [英] unable to import org.sun.management.OperatingSystemMXBean in java class?
问题描述
我在JRE系统库中看到 org.sun.management
,但我无法在我的eclipse中导入。允许它的任何原因。甚至maven编译失败
这里是截图。
我使用 Java 8。
我正在尝试这样做:
if(operatingSystemBean instanceof com.sun.mananagement.OperatingSystemMXBean){
})
Eclipse阻止您访问Sun的专有实现细节,因为它无法通过其他JVM移植。
您可以更改项目设置,以便Eclipse将此类问题视为警告而不是错误。
我在Mac上最新Eclipse的步骤:
项目 - 属性
- > Java编译器
- >错误/警告
- >启用项目特定设置
- >不推荐使用和限制API
- >禁止参考:警告
I see the org.sun.management
in JRE System library but I am unable to import in my eclipse. Any reasons why it is allowed. even maven compilation fails
here are the screenshots.
I am using Java 8.
I am trying to do this:
if (operatingSystemBean instanceof com.sun.mananagement.OperatingSystemMXBean) {
})
Eclipse is preventing you from accessing Sun's proprietary implementation details as that won't be portable across other JVMs.
You can change the project settings so that Eclipse will treat that type of issue as a warning rather than as an error.
My steps for Latest Eclipse on Mac:
Project - Properties -> Java Compiler -> Errors / Warnings -> Enable Project specific settings -> Deprecated and restricted API -> Forbidden reference : Warning
这篇关于无法在java类中导入org.sun.management.OperatingSystemMXBean?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!