java - Why is access restricted to jre6/lib/rt.jar for OperatingSystemMxBean? -


i'm having little trouble java code i'm trying compile in eclipse. keep getting following warning...

access restriction: type operatingsystemmxbean not accessible due restriction on required library c:\program files\java\jre6\lib\rt.jar 

from line of code...

com.sun.management.operatingsystemmxbean bean = (com.sun.management.operatingsystemmxbean) java.lang.management.managementfactory.getoperatingsystemmxbean(); 

i've found ways around i'm worried restriction warning. code open source project (cftracker) , don't want work around restriction if i'm going breaking sort of license agreement. can me understand this?

this not problem of license agreements. eclipse trying protect using classes not part of official jdk api (but rather, part of oracle/sun's jvm implementation).

is there particular reason need class cast (rather using the "official" interface java.lang.management.operatingsystemmxbean)?

if want make sure application continues run when expected mxbean not available, add try/catch logic gracefully handle classcastexception.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -