Eclipse gives warning on access restriction for jfxrt.jar classes


Question

I'm using eclipse kepler with java SE 1.8 jdk system library but when I use any javafx classes or methods eclipse gives a warning like Access restriction: The type 'TableColumn<?,?>' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_05\jre\lib\ext\jfxrt.jar').

I have tried adding an access rule to the system library to allow access for all jars in the library using the wildcard * but the warning is still there. Am also using maven for building project. The code works but the warning is nagging and is affecting readability as I code. Any help is appreciated.

Edit: I also tried adding @SuppressWarnings("restriction") at the beginning of my classes but this still doesn't solve the unknown cause and hides all other restriction warnings that I may need to see

1
20
8/28/2015 9:29:51 PM

Accepted Answer

You can choose ignore in the following settings:

Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
(Project) Properties -> Java Compiler -> Errors/Warnings

Use filter to find "Forbidden reference"

Forbidden reference (access rules) : Change it to "ignore"

enter image description here

4
11/3/2015 1:48:01 PM

I'm able to get past this by reconfiguring Java library. For example, explicitly selecting Oracle JDK does the trick.

Configure Build Path

Edit Java lib

Select explicit JDK


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon