Java launch error selection does not contain a main type

心已入冬 提交于 2019-11-29 05:34:33
Mudassir

You cannot define the main method as you do in C++.

For the Java interpreter, the main method must always be public and static. So you need to change your main method signature to

public static void main(String args[])

Try this, and feel free to ask further. :-)

Create a new project and make the build path to point to the existing source folders. This will resolve the "Selection does not contain a main type" error.

I also experienced this problem and could solve it. The solution was not mentioned yet.

In my case I'm working in Eclipse with Xtend and I converted the project to maven. After that there was a source-exclusion entry in your classpath file:

<classpathentry excluding="**" kind="src" output="target/classes" path="xtend-gen">

Then you just need to delete this line and do a clean build.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!