Accepted answer

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


adding a right jre system through build path is the solution but your eclipse still may have the error. to solve that go to java build path --> order and export and move your jre system library on the top. this has solved my problem.


in my case there was a mismatch between the build path jre and installed jre on execution environment. i moved into project > properties > java compiler. there was a warning message at the bottom.

i clicked on the links 'installed jre', 'execution environment', 'java build path' and changed the jdk version to 1.7 and the warning disappeared.


just change the order of build path libraries of your project. right click on project>build path> configure build path>select order and export(tab)>change the order of the entries. i hope moving the "jre system library" to the bottom will work. it worked so for me. easy and simple....!!!


in the case you are sure that you should be able to access given class, than this can mean you added several jars to your project containing classes with identical names (or paths) but different content and they are overshadowing each other (typically an old custom build jar contains built-in older version of a 3rd party library).

for example when you add a jar implementing:


but also an older version implementing only:

(d2 is missing altogether or has restricted access)

everything works fine in the code editor but fails during the compilation if the "old" library overshadows the new one - d2 suddenly turns out "missing or inaccessible" even when it is there.

the solution is a to check the order of compile-time libraries and make sure that the one with correct implementation goes first.


go to the java build path in the project properties. remove the existing jre system library then add it again i.e. add library-->jre lib--select jre--->finish. lastly select order and export tab select jre lib and move on top. that's it.


sorry for updating an old post. i got the reported problem and i solved it as said below.

assuming you are using eclipse + m2e maven plugin, if you get this access restriction error, right click on the project/module in which you have the error --> properties --> build path --> library --> replace jdk/jre to the one that is used in eclipse workspace.

i followed the above steps and the issue is resolved.


in addition to nels beckman's solution, i have the following tips:

under configure build path, i had to rearrange the order of my entries under order and export.

additionally, as an eclipse pde developer, i needed to rearrange the order of my dependencies in my, adding the problematic package as first on the list.

playing with these dials, along with running project > clean in between, i was able to resolve these warnings.


for me this how i solve it:

  • go to the build path of the current project

under libraries

  • select the "jre system library [jdk1.8xxx]"
  • click edit
  • and select either "workspace default jre(jdk1.8xx)" or alternate jre
  • click finish
  • click ok

enter image description here

note: make sure that in eclipse / preferences (not the project) / java / installed jre ,that the jdk points to the jdk folder not the jre c:\program files\java\jdk1.8.0_74

enter image description here


i just had this problem too. apparently i had set the jre to 1.5 instead of 1.6 in my build path.


  • go to the build path settings in the project properties. windows -> preferences -> java compiler
  • remove the jre system library
  • add another jre with a "perfect match"
  • clean and build your project again. it worked for me.


i have been getting this error too, but my project is built on the command line using maven and the tycho compiler (it's a set of osgi plugins). after masses of sifting through people having the same problem but fixing it in eclipse rather than on the command line, i found a message on the tycho developer forum that answered my question, using configuration in pom.xml to ignore the compiler warning about the access restriction:


more information can be found in the tycho faq. this took me ages to work out, so i figured i would assist anyone else trying to fix these access restriction errors from the command line by posting this answer.


my guess is that you are trying to replace a standard class which ships with java 5 with one in a library you have.

this is not allowed under the terms of the license agreement, however afaik it wasn't enforced until java 5.

i have seen this with qname before and i "fixed" it by removing the class from the jar i had.

edit notes for the option "-xbootclasspath:"

"applications that use this option for the purpose of overriding a class in rt.jar should not be deployed as doing so would contravene the java 2 runtime environment binary code license."


"java technology restrictions. you may not modify the java platform interface ("jpi", identified as classes contained within the "java" package or any subpackages of the "java" package), by creating additional classes within the jpi or otherwise causing the addition to or modification of the classes in the jpi. in the event that you create an additional class and associated api(s) which (i) extends the functionality of the java platform, and (ii) is exposed to third party software developers for the purpose of developing additional software which invokes such additional api, you must promptly publish broadly an accurate specification for such api for free use by all developers. you may not create, or authorize your licensees to create, additional classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by sun in any naming convention designation."


i met the same problem. i found the answer on the website:
first, delete the jre system libraries. then, import jre system libraries again.

score:128 worked best for me.

on windows: windows -> preferences -> java -> compiler -> errors/warnings -> deprecated and restricted api -> forbidden reference (access rules): -> change to warning

on mac os x/linux: eclipse -> preferences -> java -> compiler -> errors/warnings -> deprecated and restricted api -> forbidden reference (access rules): -> change to warning

Related Query

More Query from same tag