Using JavaFX in JRE 8, “Access restriction” error
When trying to use javafx related classes in my new java 8 project I get an access restriction error from eclipse. So far the only 'solution' I've been able to find is to tell eclipse to ignore the access restriction, but I am not satisfied with that. An example of the error:
Access restriction: The type Pane is not accessible due to restriction on required library C:\Program Files\Java\jre8_0\lib\ext\jfxrt.jar
I'm using Eclipse Kepler with the Eclipse JDT patch for java 8.
This seems to be an issue related to the fact that JavaFX is not a part of the JavaSE execution environment.
I am now toughly confused as according to http://en.wikipedia.org/wiki/JavaFX javaFX is a part of the JavaSE. Is it possible that Eclipse is not recognizing that it is a part of the javaSE?
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 http://efxclipse.bestsolution.at/install.html