Java 由于对所需库的限制,JFrame 受到限制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24600077/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JFrame Restricted due to restriction on required library
提问by VeXeD_1357
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:
我正在 eclipse 中创建一个新的 Java 项目。唯一的问题是,在出现错误之前,我什至没有输入五行:
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.
我该如何解决这个问题?如果有人已经问过类似的问题,请原谅我。我还是个初学者。
回答by Simiil
Try removing and readding the Java System Library to your project:
尝试删除 Java 系统库并将其读取到您的项目中:
Project Properties -> Build Path -> Libraries -> Remove , and then Add Library -> JRE System Library
项目属性 -> 构建路径 -> 库 -> 删除,然后添加库 -> JRE 系统库
Try closing and reopening the Dialog after removing the the Library
删除库后尝试关闭并重新打开对话框