i had faced the same error on eclipse 4.20.0 with jre 1.8. to get rid of this compilation error, do the following:

project --> properties --> java compiler --> errors/warnings --> deprecated and restricted api --> forbidden reference (access rules) -->  ignore


i'm using eclipse neon 3. i just wanted to use javafx.application.application, so i followed christian hujer's answer above and it worked. just some tips: the access rules are very similar to the import statement. for me, the access rules i added was "javafx/application/**". just replace the dot in the import statement with forward slash and that's the rule. hope that helps.


i had a little different problem. in project - properties - libraries - jre library, i had the wrong jre lib version. remove and set the actual one, and voila - all access restriction... warnings are away.


if someone is having this issue only in your ci tool while running maven, what did the trick for me was to explicitly define the execution environment in your

in my case, i did this by inserting the following line in my osgi bundle manifest file:

bundle-requiredexecutionenvironment: javase-1.8


what worked for me was adding the access restricted package to the file. in eclipse, the "access restricted" errors showed up in the problems tab for several files. i just right clicked on each error, clicked "quick fix", and chose "add '[package]' to imported packages".


remove existing/configured system library: eclipse(ide) -> project explorer -> project name-> (option) build path -> configure build path -> java build path -> libraries -> (select) jre system library [(for me)jre1.8.0_231] -> remove.

currently you are at same location: eclipse(ide) -> project explorer -> project name-> (option) build path -> configure build path -> java build path -> libraries

now add same system library again: add library -> jre system library -> workspace default jre ((for me)jre1.8.0_231) -> finish -> apply -> close.

now wait to finish it.


i have eclipse jre 8.112 , not sure if that matters but what i did was this:

  1. right clicked on my projects folder
  2. went down to properties and clicked
  3. clicked on the java build path folder
  4. once inside, i was in the order and export
  5. i checked the jre system library [jre1.8.0_112]
  6. then moved it up above the one other jre system library there (not sure if this mattered)
  7. then pressed ok

this solved my problem.


i simply just add e(fx)clipse in eclipse marketplace. easy and simple


even if its old question, for me in eclipse i just right click on src folder and properties (alt+enter) and the check for the ignore optional compile problems removed the error.

enter image description here


in eclipse mars.2 release (4.5.2):
project explorer -> context menu -> properties -> javabuildpath -> libraries
select jre... and press edit: switch to workspace jre (jdk1.8.0_77)

works for me.


go to the following setting:

window -> preferences -> java-compiler-errors/warnings-deprecated and restricted api-forbidden reference (access rules)

set it to warning or ignore.


had the same problem. here's how i solved it: go to package explorer. right click on jre system library and go to properties. in the classpath container > select jre for the project build path select the third option (workspace default jre).

source :


we use ibm rational application developer (rad) and had the same problem.


access restriction: the type 'jaxwsproperties' is not api (restriction on required library 'c:\ibm\rad95\jdk\jre\lib\rt.jar')


go to java build path and under library tab, remove jre system library. then again add library --> jre system library


if you're having this same issue using spring tool suite:

the spring tool suite's underlying ide is, in fact, eclipse. i've gotten this error just now trying to use some classes. to remove these errors and prevent them from popping up in the eclipse luna sr1 (4.4.2) platform of sts:

  • navigate to project > properties
  • expand the java compiler heading
  • click on errors/warnings
  • expand deprecated and restricted api
  • next to "forbidden reference (access rules)" select "ignore"
  • next to "discouraged reference (access rules)" select "ignore"

you're good to go.


in the eclipse top menu bar:

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


it worked: project properties -> projectfacets -> runtimes -> jdk1.8.0_45 -> apply


i had this problem because the project facet associated with my project was the wrong java version.

to fix this is i did the following:

  1. right click on the project and select properties
  2. select 'project facets' and change version of java to something greater than 1.4.
  3. click [apply]

this will rebuild your project and hopefully the error will be resolved.


we had to change our application to build against the jdk 1.8 using window->preferences->java->installed jres. however, after changing that, the jre system library specified in the project explorer was still incorrect. to fix this, right click on "jre system library [wrong-jre-here]" and change from execution environment: to "workspace default (yer-default-here)"

enter image description here


to begin with (and unrelated), instantiating the application class by yourself does not seem to be its intended use. from what one can read from its source, you are rather expected to use the static instance returned by getapplication().

now let's get to the error eclipse reports. i've ran into a similar issue recently: access restriction: the method ... is not api (restriction on required project). i called the method in question as a method of an object which inherited that method from a super class. all i had to do was to add the package the super class was in to the packages imported by my plugin.

however, there is a lot of different causes for errors based on "restriction on required project/library". similar to the problem described above, the type you are using might have dependencies to packages that are not exported by the library or might not be exported itself. in that case you can try to track down the missing packages and export them my yourself, as suggested here, or try access rules. other possible scenarios include:

  • eclipse wants to keep you from using available packages that are not part of the public java api (solution 1, 2)
  • dependencies are satisfied by multiple sources, versions are conflicting etc. (solution 1, 2, 3)
  • eclipse is using a jre where a jdk is necessary (which might be the case here, from what your errors say; solution) or jre/jdk version in project build path is not the right one

this ended up as more like a medley of restriction-related issues than an actual answer. but since restriction on required projects is such a versatile error to be reported, the perfect recipe is probably still to be found.


adding javafx accessible permission in eclipse oxygen go to project> properties> java build path> libraries> then expand the libraries and double click on> access rules there you set the permission resolution : accessible rule pattern : javafx/**

enter image description here

enter image description here

enter image description here


i was having the same problem. when i initially created the java project in eclipse i specified jre 8. when i went into the project's build path and edited the jre system library, the java 8 execution environment was selected. when i chose to use an "alernate jre" (still java 8) it fixed the error for me.


this happened to me as well, and the answers given here already were not satisfying, so i did my own research.

background: eclipse access restrictions

eclipse has a mechanism called access restrictions to prevent you from accidentally using classes which eclipse thinks are not part of the public api. usually, eclipse is right about that, in both senses: we usually do not want to use something which is not part of the public api. and eclipse is usually right about what is and what isn't part of the public api.


now, there can be situations, where you want to use public non-api, like sun.misc (you shouldn't, unless you know what you're doing). and there can be situations, where eclipse is not really right (that's what happened to me, i just wanted to use javax.smartcardio). in that case, we get this error in eclipse.


the solution is to change the access restrictions.

  • go to the properties of your java project,
    • i.e. by selecting "properties" from the context menu of the project in the "package explorer".
  • go to "java build path", tab "libraries".
  • expand the library entry
  • select
    • "access rules",
    • "edit..." and
    • "add..." a "resolution: accessible" with a corresponding rule pattern. for me that was "javax/smartcardio/**", for you it might instead be "com/apple/eawt/**".

Related Query

More Query from same tag