Access Restriction on Class Due to Restriction on Required Library 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 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! :)

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.

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.

Eclipse gives warning on access restriction for jfxrt.jar classes

You can choose ignore in the following settings:

Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
(Project) Properties -> Java Compiler -> Errors/Warnings

Use filter to find "Forbidden reference"

Forbidden reference (access rules) : Change it to "ignore"

Sample Image



Related Topics



Leave a reply



Submit