Accepted answer

from the eclipse point of view the error is totally correct because javafx is coming from the extension classpath and is not available on all java8 vms (e.g. ibm!).

as outlined you can suppress those warnings by add access-rules or imho the best solution is to install e(fx)clipse which does this automatically for you and beside that even provides you tooling for javafx css and fxml.

you can grab an all in one package from


step-1: navigate to your jfxrt.jar. c:\program files\java\jre1.8.0_111\lib\ext

step-2 copy the file jfxrt.jar

step-3: go to eclipse,create a new folder like this: [creating folder name lib to put our jfxrt.jar file][2] [2]:

step-4: select the lib folder and press ctrl+v to paste the jfxrt.jar [paste your jfxrt.jar][1] [1]:

step-5: right click on jfxrt.jar and set as build path.


as james_d already suggested i added access rules to my classpath file. i uninstalled the e(fx)clipse plugin for the time being because it has a css validation bug (see how to disable css warning "unknown property" in eclipse mars?).

here is my entry in the classpath file for the jre container:

<classpathentry kind="con" path="org.eclipse.jdt.launching.jre_container/org.eclipse.jdt.internal.debug.ui.‌​launcher.standardvmtype/javase-1.8">
        <attribute name="maven.pomderived" value="true"/>
        <accessrule kind="accessible" pattern="javafx/**"/>
        <accessrule kind="accessible" pattern="com/sun/javafx/**"/>


i had the same problem. i used james_d 's solution but his exact solution did not work for me. but using **/javafx/** instead of javafx/** solved the problem for me. hope that helps.

ps: i would post this as a comment under james_d 's solution but i just registered and did not have enough "reputation" to do so.


follow these steps:

  1. add the jfxrt.jar (from your installation folder) as an "external jar file" in the 'libraries' tab.

  2. in the 'order/export' tab, ensure that this jfxrt.jar is first in the list.

this worked for me.


i know this has been answered already, but i find the proposed solutions clunky.

  1. i don't want to install a plugin just to avoid what i consider to be an invalid error.
  2. adding jfxrt.jar as external jar will work, but is a bad idea if you plan on doing an export because jfxrt.jar will be exported as well. probably not what you want.

another option

in 'mars' release (and possibly earlier versions) you can disable access restrictions errors. under

java->compiler->errors/warnings view


"deprecated and restricted api"

you can set "forbidden reference (access rule)" to ignore.

enter image description here


  • 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've resolved this problem by some careful use of the eclipse project's build path.

  • bring up the properties of the you application project and select the 'build path' section.
  • add the jre8_0\lib\ext\jfxrt.jar as an "external jar file" in the 'libraries' tab.
  • in the 'order/export' tab ensure that this jfxrt.jar is first in the list.

what this doing is making eclipse see the jfxrt.jar as just a regular 3rd party jar file. the order is important so that this takes precedence over the entry in the jre system library. it's the same actual jar file, but eclipse is seeing it differently.

you may wish to alter any run configurations so it doesn't use the 'exported' version of the jfxrt.jar; however in practical terms this won't make a difference.

i've done this with java8 and eclipse luna; but the principal would i am sure work with any combination of java and eclipse.


the easy way is to install e(fx)clipse - a plugin for eclipse to support javafx:

  1. select help -> install new software
  2. click add button to add the following site:
  3. click ok
  4. in the "work with", select the recently added site "efxclipse"
  5. check the checkbox "e(fx)clipse - install" to install all components of this selection
  6. move to next steps to finish the installation
  7. restart your eclipse. if it still doesn't recognize javafx library, restart it again.

original information can be found here:


i resolved the problem by removing and readding the jdk to the build path. don't ask me why this works, though.


i'm going to add one more answer here, just to provide what i think is the most minimal approach. in my eclipse setup, i have e(fx)clipse installed, which provides one fix for this, as well as providing many useful development features that you will almost certainly want if you are writing javafx applications. this is probably the most practical approach. if for some reason you don't want that plugin, the solution outlined in this answer will fix the problem with the least amount of other side effects.

as pointed out in other answers, eclipse, by default, disallows access to classes in jar files in the jre/lib/ext directory, as these are not guaranteed to be present on all java platforms. if you are writing a javafx 8 application, you are assuming you are on a platform where jfxrt.jar is available in the lib/ext location.

so the minimal fix for this is to allow access to the classes in this jar file (and only in this jar file). to do this, right-click on the project and bring up the project properties dialog. select "build path" in the left pane, and select the "libraries" tab. you will see a "jre system library" entry. expand that entry, and you will see an "access rules" subentry:

enter image description here

select the "access rules" entry and click "edit". click "add".

enter image description here

under "resolution", choose "accessible", and under "rule pattern", enter javafx/**:

enter image description here

click ok to exit all the dialogs.

this setting will allow access to all the classes in any packages beginning javafx., but will preserve the rule on the ext folder for all other classes, and is "minimal" in that sense.

again, what you probably really want to do is to install the e(fx)clipse plugin, but to my knowledge this is the solution with the least side effects on your eclipse setup.

Related Query

More Query from same tag