editor does not contain a main type的解决方案
editor does not contain a main type的解决方案
今天用eclipse,当打算run一个带有main函数的class时,出现editor does not contain a main type的错误框。
baidu了一下,迅速解决问题:原来这个class所在包没有被添加到build path中。
解决方法:在左侧的package explorer中右击这个class所在包的上一级目录--build path--use as source folder。这样就解决问题了。
重新打开class,再run一下,ok了。
-----------------------------------------------------
补充和解释:
哎,好吧。再稍微简单解释下。
看这张图,src就是在build path中的(仔细观察src的图标)
相对的,resource就只是个普通文件夹,而不在build path中(图标和src不一样吧?)
然后我又在resource下新建了文件夹和文件,比较下,包和文件夹的图标也是不一样的。
现在,我要把resource也加到build path中。(方法就是右击resource--build path--use as source folder)
这样,src和resource就都在build path中了。
最后,解释下,什么叫“在build path中”?你可以这么理解,eclipse中,在build path下的类可以被编译运行,在build path下的配置文件可以被类以相对路径直接读写。
editor does not contain a main type的解决方案的更多相关文章
- Eclipse 软件 Java 解决:出现的editor does not contain a main type错误框 问题
Eclipse 软件 解决:出现的 editor does not contain a main type 错误框 问题 当你运行 Java文件是,如果弹出了下面的 错误框: 出现错误的原因: 当前的 ...
- MyEclipse上有main函数类运行报错:Editor does not contain a main type
MyEclipse下有main函数类运行报错:Editor does not contain a main type 出现这种问题的原因是,该java文件所在的包没有被MyEclipse认定为源码包. ...
- eclipse解决editor does not contain a main type的方法
转自:http://blog.csdn.net/huazhangena/article/details/7349044 写在前面的话:我的也出现这个问题,但是解决方法和转发的内容不太一样,原理一样,我 ...
- 【eclipse】Editor does not contain a main type
问题现象: eclipse运行java程序的时候弹出对话框:Editor does not contain a main type. 解决方法: 右击 src路径 → Build Path → Use ...
- editor does not cantain a main type——解决
editor does not cantain a main type 这个错误就是包名与路径不对
- Editor does not contain a main type
1.错误描述 2.错误原因 在含有main方法的类中,运行应用程序,却提示这个错误:编译器不包含main类型 3.解决办法 (1)选择该Java类上一级文件,build path--->use ...
- “selection does not contain a main type”解决方法
在运行java程序时,出现了错误“selection does not contain a main type”. 是因为.java文件不在项目的src路径内,也就是说源代码未被eclipse编译,字 ...
- WPF学习- 新建项目后自定义Main()[Type 'App' already defines a member called 'Main' with the same parameter types]
问题点: 在App.xaml.cs中自己添加Main方法,编译会出现如下报错: 错误 CS0111 类型“App”已定义了一个名为“Main”的具有相同参数类型的成员 错误 Type 'App' a ...
- mybatis-plus的Could not set property 'updateDate' of 'class com.example.pojo.User' with value 'Fri Jul 24 10:29:39 CST 2020' Cause: java.lang.IllegalArgumentException: argument type mismatch解决方案
按照官网在写mybatis-plus的自动填充功能一直报错,发现官网的解说不全,数据库是datetime类型,java程序又是date,类型不匹配 org.mybatis.spring.MyBatis ...
随机推荐
- idea安装
- 基于事件的异步模式(EAP)
什么是EAP异步编程模式 EAP基于事件的异步模式是.net 2.0提出来的,实现了基于事件的异步模式的类将具有一个或者多个以Async为后缀的方法和对应的Completed事件,并且这些类都支持异步 ...
- (转)redis 3.0的集群部署
一:关于redis cluster 1:redis cluster的现状 reids-cluster计划在redis3.0中推出,可以看作者antirez的声明:http://antirez.com/ ...
- 深入理解JQuery插件开发
如果你看到这篇文章,我确信你毫无疑问会认为jQuery是一个使用简便的库.jQuery可能使用起来很简单,但是它仍然有一些奇怪的地方,对它基本功能和概念不熟悉的人可能会难以掌握.但是不用担心,我下面已 ...
- 获取指定DLL程序集Config 文件
/// <summary> /// 获取调用函数所在程序集的配置信息 /// </summary> /// <returns></returns> pr ...
- Jupyter Notebook 27绝技——27 Jupyter Notebook tips, tricks and shortcuts
转载自:https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/ Jupyter notebook, formerly ...
- VisualSVN 4.0.12补丁原创发布
VisualSVN 4.0.12补丁原创发布
- 例子:Background Transfer Service Sample
本例演示了如何使用后台传输服务来进行后台文件下载,也就是说及时App已经停止运行,同样可以通过后台代理进行文件的下载操作. 对于后台文件传输一下知识点必须注意: 1. 通过使用 BackgroundT ...
- unity5.0材质添加问题
将Material拖放到Cube的Inspector视图中 材质添加图片背景,unity自带了很多种材质类型点击Shader下拉按钮可以更换材质类型为Diffuse camera preview: G ...
- 在浏览器地址栏前添加自定义的ico图标
首先,我们需要预先制作一个图标文件,大小为16*16像素.文件扩展名为ico,然后上传到相应目录中. 在HTML源文件“<head></head>”之间添加如下代码: < ...