Eclipse Java error: This selection cannot be launched and there are no recent launches

后端 未结 9 1935
孤独总比滥情好
孤独总比滥情好 2021-02-05 03:21

I have looked everywhere on the internet and tried everything the forums say to do and nothing works. This error keeps coming up. I have tried running my java project (not for a

相关标签:
9条回答
  • 2021-02-05 03:53

    Eclipse needs to see a main method in one of your project's source files in order to determine what kind of project it is so that it can offer the proper run options:

    public static void main(String[] args)
    

    Without that method signature (or with a malformed version of that method signature), the Run As menu item will not present any run options.

    0 讨论(0)
  • 2021-02-05 03:55

    When you create a new class file, try to mark the check box near

    public static void main(String[] args) {
    

    this will help you to fix the problem.

    0 讨论(0)
  • 2021-02-05 03:55

    Have you checked if:

    1. You created a class file under src folder in your JAVA project?(not file)
    2. Did you name your class as the same name of your class file?

    I am a newbie who try to run a helloworld example and just got the same error as yours, and these work for me.

    0 讨论(0)
  • 2021-02-05 03:59

    click on the project that you want to run on the left side in package explorer and then click the Run button.

    0 讨论(0)
  • 2021-02-05 04:10

    Make sure the "m" in main() is lowercase this would also cause java not to see your main method, I've done that several times unfortunately.

    0 讨论(0)
  • 2021-02-05 04:10

    It happens when sometimes we copy or import the project from somewhere. The source folder is a big thing to concern about.

    One simple technique is, create a new project, inside the source folder, create a new class and paste the content over there.

    It will work...

    Hope it helps.

    0 讨论(0)
提交回复
热议问题