Access Restriction: Is Not Accessible Due to Restriction on Required Library ..\Jre\Lib\Rt.Jar

Access restriction on class due to restriction on required library rt.jar?

There's another solution that also works.

  1. Go to the Build Path settings in the project properties.
  2. Remove the JRE System Library
  3. Add it back; Select "Add Library" and select the JRE System Library. The default worked for me.

This works because you have multiple classes in different jar files. Removing and re-adding the JRE lib will make the right classes be first.
If you want a fundamental solution make sure you exclude the jar files with the same classes.

For me I have: javax.xml.soap.SOAPPart in three different jars: axis-saaj-1.4.jar, saaj-api-1.3.jar and the rt.jar

Access restriction on jdk1.7/jre/lib/rt.jar

This problem occurs when you class path is referring to JRE instead of the JDK in which the Project is open into , do one thing go to

Build Path > Libraries

Remove the Runtime that is included and add the jdk runtime , it should solve your problem now.

Access restriction on class due to restriction on required library

At a guess another library you are using also requires Apache Commons I/O, but a different version. Having a piece of code (transitively) have access to two versions of the same packages is a little tricky. You can probably arrange it so your code and the other library use the same version. It's all much easier with CLASSPATH! :)

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

This is not a problem of license agreements. It is just Eclipse trying to protect you from using classes that are not part of the official JDK API (but rather, part of Oracle/Sun's JVM implementation).

Is there a particular reason that you need to class cast (rather than using the "official" interface java.lang.management.OperatingSystemMXBean)?

If you want to make sure that your application continues to run when the expected MXBean is not available, you could add some try/catch logic to gracefully handle a ClassCastException.

Error: Access restriction: The type 'DataSource' is not API (restriction on required library ..\rt.jar)

Go to build path settings of your project in eclipse. Remove JRE system library. Add it again. This should resolve your error.



Related Topics



Leave a reply



Submit