selection does not contain a main type错误
来源:互联网 发布:java new string 编辑:程序博客网 时间:2024/05/16 08:14
程序有main函数,在Eclipse中运行后出现selection does not contain a main type错误,环境配置是正确的
出现这个问题,是因为.java文件不在项目的src路径内,也就是说源代码未被eclipse编译,字节码不存在无法运行了
在项目名上右键 -> Builder Path -> Configure Build Path -> 选择Source面板再点Add Folder, 把源代码所在的包路径的上层目录加进来,而且如果你是把两个类写在一个文件里的话,你在右键选择Run As JavaAppication 的时候,要把光标至于包括main方法的类上
看看这样行不行:
重新建立一个Java Project工程,弹出一个对话框,这里注意:
选择:Create new project in workspace
不要选别的选项,然后再建立一个含有main方法的类,再测试。
希望对您有所帮助!
我的错误原因是:在新建java project时勾选了Create separate folders as root for sources and class files.
只要勾选Use project folder as root for sources and class files就行了
出现这个问题,是因为.java文件不在项目的src路径内,也就是说源代码未被eclipse编译,字节码不存在无法运行了
在项目名上右键 -> Builder Path -> Configure Build Path -> 选择Source面板再点Add Folder, 把源代码所在的包路径的上层目录加进来,而且如果你是把两个类写在一个文件里的话,你在右键选择Run As JavaAppication 的时候,要把光标至于包括main方法的类上
看看这样行不行:
重新建立一个Java Project工程,弹出一个对话框,这里注意:
选择:Create new project in workspace
不要选别的选项,然后再建立一个含有main方法的类,再测试。
希望对您有所帮助!
我的错误原因是:在新建java project时勾选了Create separate folders as root for sources and class files.
只要勾选Use project folder as root for sources and class files就行了
阅读全文
0 0
- selection does not contain a main type错误
- selection does not contain a main type错误
- selection does not contain a main type错误
- selection does not contain a main type错误
- selection does not contain a main type
- selection does not contain a main type
- selection does not contain a main type
- selection does not contain a main type
- selection does not contain a main type的解决方案!
- eclipse selection does not contain a main type
- win7 eclipse: selection does not contain a main type
- Eclipse报错 "Selection does not contain a main Type"
- Eclipse中出现Editor does not contain a main type或者Selection does not contain a main type
- selection dose not contain a main type
- Eclipse中运行出现selection does not contain a main type错误
- "editor does not contain a main type" 错误解决方法
- eclipse的editor does not contain a main type错误
- 解决Editor does not contain a main type错误
- 阿里Java开发规范IDEA开发插件
- 数据结构上机测试2-1:单链表操作A
- Windows下安装tensorflow步骤--更ok
- LeetCode Blog for course "Algorithms" -- Problem 9
- 【C++】函数的传递方式
- selection does not contain a main type错误
- gcc编译32位(64位)程序
- 给Django 添加网页icon
- Python lambda介绍
- Ubuntu16.04.3 下安装Qt5.9.1 OpenCV3.2.0 (包括OpenCV_contrib)完美版
- 开始,没有标题
- 我的第一个java程序:HelloWord
- Centos7安装LAMP环境(apache + mysql + php)
- 深入理解ThreadLocal