![](https://img-blog.csdnimg.cn/2020081117172522.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
idea errors and warnings
在使用eclipse进行编译过程中出现的errors、warnings。
further_
这个作者很懒,什么都没留下…
展开
-
Resource leak: ‘scanner‘ is never closed
eclipse warning:Resource leak: ‘scanner’ is never closed.原因:你申请了一个输入流system.scanner,但是在你用完这个后没有将其关闭,所以会出现警告。这是资源泄漏:“扫描器”永远不会关闭”。解决方法:在输入或者main函数后加上scanner.close();就是调用你创建的对象的close()方法。你创建的输入流对象名.close();...原创 2020-08-25 22:53:27 · 2032 阅读 · 0 评论 -
Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace
创建项目后报错:Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that arestrictly compatible with this environment.解决方法:右键当前项目,选择 properties,在新窗口中选择 java build path,然后切换到 Libraries 选项卡,移除“JRE System Library[J2S原创 2020-08-25 22:42:35 · 2051 阅读 · 1 评论 -
Access restriction: The constructor ‘JFrame(String)‘ is not API (restriction on required library ‘C:
Access restriction: The constructor ‘JFrame(String)’ is not API (restriction on required library ‘C:\Program Files\Java\jre1.8.0_261\lib\rt.jar’)错误原因:jre配置错误解决方法:项目右键 - Build Path - Configure Build Path ;选择“Libraries”面板 ,然后双击"JRE System Library…";选择“Java原创 2020-08-25 22:40:02 · 846 阅读 · 0 评论 -
Syntax error on token “}“, delete this token.
eclipse error:Syntax error on token “}”, delete this token.错误原因:多了或者少了一个 { 。请仔细观察代码,手动修改正确即可解决报错。原创 2020-08-25 22:38:13 · 14801 阅读 · 0 评论 -
The import javax.swing.JFame(包/类) cannot be resolved.
eclipse错误:The import javax.swing.JFame cannot be resolved.问题:表示没有这个包/类,可能是你打错了,或者没有导入包。检查一下代码拼写,还有你导入的包/类是否是原有的,不是的话记得去下载后导入。...原创 2020-08-11 17:32:09 · 1853 阅读 · 1 评论 -
The import java.util.Scanner(XX类) is never used.
eclipse警告:The import java.util.Scanner is never used.问题:这个只是表示你导入这个类但你还没使用,你继续写便可,用到这个类后警告自动消失。原创 2020-08-11 17:14:57 · 3815 阅读 · 2 评论 -
The serializable class XXX does not declare a static final serialVersionUID field of type long
eclipse警告:warning: The serializable class XXX does not declare a static final serialVersionUID field of type long…解决方法:在类里面加入 private static final long serialVersionUID = 1L;详细描述why:https://blog.csdn.net/Hiwes/article/details/78511060...原创 2020-08-11 18:01:34 · 334 阅读 · 0 评论 -
The compiler compliance specified is 1.7 but a JRE 1.8 is used
The compiler compliance specified is 1.7 but a JRE 1.8 is used。原因:你安装的jdk里面的jre 和你eclipse设置的jre 不同。解决:法①window->preferences->Java->Installed JREs, 然后更改版本。法②右键点击你建立的项目 >Properties>Java Compiler>将Compiler compliance level改为1.8 ,再点击Apply原创 2020-08-11 16:58:06 · 2783 阅读 · 1 评论