14

I am making a new Java project in eclipse. The only problem is that I didn't even get five lines in before I got an error that reads:

Access Restriction: The type JFrame is not accessible due to restriction on 
required library C:\Program Files\Java\jre8\lib\rt.jar

How do I fix this issue? Please forgive me if someone already asked a similar question. I am still a beginner.

VeXeD_1357
  • 141
  • 1
  • 1
  • 5

1 Answers1

36

Try removing and readding the Java System Library to your project:

Project Properties -> Build Path -> Libraries -> Remove , and then Add Library -> JRE System Library

Try closing and reopening the Dialog after removing the the Library

Simiil
  • 2,196
  • 1
  • 20
  • 30
  • 3
    Why does this work? More importantly, why does this happen? +1 – Nick Sep 06 '16 at 00:37
  • @Nick if it still matters,it's because the original path of the JRE is changed and the project JRE path doesn't match the actual path. – Ivan Kukic Jul 02 '19 at 17:03