欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

eclipse bug(一)Selection does not contain a main type

程序员文章站 2022-06-12 22:51:41
...

右键带有main函数的项目时:Selection does not contain a main type

eclipse bug(一)Selection does not contain a main type


eclipse bug(一)Selection does not contain a main type


I am trying to run some java files in a new project. So I make the project, put the files in it and I try to run the main file so my game starts.

I get an error that says selection does not contain a main type.

I have tried several ways to run it:

  • Some say to launch eclipse again, tried this a dozen times.
  • Somewhere else someone pointed to open a new project and make a build path to the old project.

Didn't work either.

解决方案(一):

trying to run the main class in this way see screen shot: eclipse bug(一)Selection does not contain a main type

If no then try this way and if yes then please make sure that your class you are going to run have main method i-e

public static void main(String[] args)

I am trying to run some java files in a new project. So I make the project, put the files in it and I try to run the main file so my game starts.

I get an error that says selection does not contain a main type.

I have tried several ways to run it:

  • Some say to launch eclipse again, tried this a dozen times.
  • Somewhere else someone pointed to open a new project and make a build path to the old project.

Didn't work either.


解决方案(二):

 if you are still having a problem you might not have your class inside the src folder in which case Eclipse may not see it as part of the project. This would also invoke the same error message you have seen.

Right click on the folder where you put your main class then click on Build Path --> Use as Source Folder

eclipse bug(一)Selection does not contain a main type

早晚会遇到的



I am trying to run some java files in a new project. So I make the project, put the files in it and I try to run the main file so my game starts.

I get an error that says selection does not contain a main type.

I have tried several ways to run it:

  • Some say to launch eclipse again, tried this a dozen times.
  • Somewhere else someone pointed to open a new project and make a build path to the old project.

Didn't work either.


相关标签: eclipse bug 调试

上一篇: Python3 模块

下一篇: sklearn