2

I have seen this question asked and answered a few times for Java being compiled in Eclipse. In my case, I don't have Eclipse. I want to get my project compiled using VS Code. I'm hoping there is a file I can create or edit to override this error message:

Access restriction: The type 'Pair' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jfxrt.jar')Java(16777523)

Any help appreciated.

In my project the .settings\org.eclipse.buildship.core.prefs contains

connection.project.dir=../..
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore

PS My project uses gradle.

user1443098
  • 6,487
  • 5
  • 38
  • 67
  • Another reason why Eclipse is rubbish. Should still be part of your JDK 8 install, but not for newer JDKs. You should reconsider JavaFX - not much support. https://stackoverflow.com/questions/35974003/javafx-comes-with-jdk-8 – duffymo Jul 11 '19 at 20:03
  • Could be but then I'm using VS Code, not Eclipse. – user1443098 Jul 11 '19 at 20:14

2 Answers2

2

try this:

1.find .settings\org.eclipse.jdt.core.prefs file in your project

2.change org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning

to org.eclipse.jdt.core.compiler.problem.forbiddenReference = ignore

Leo Zhu
  • 15,726
  • 1
  • 7
  • 23
0

change file ./.settings/org.eclipse.jdt.core.prefs with

org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore

run the command

mvn eclipse:eclipse