Access Restriction: the Type 'Application' Is Not API (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

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.

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! :)

Compiling Java with VS Code, getting restriction on required library error message

try this:

1.find .settings\org.eclipse.jdt.core.prefs file in your project

2.change org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning

to org.eclipse.jdt.core.compiler.problem.forbiddenReference = ignore

Access restriction on JavaFX classes in Eclipse Oxygen

This is discussed at length in Eclipse Bug 431067.

In addition to the workarounds in the question, the easiest is to install the e(fx)clipse plugin - https://www.eclipse.org/efxclipse/install.html.

This does the magic of configuring the necessary access restrictions within the JDK automagically.



Related Topics



Leave a reply



Submit