Eclipse cannot find the main class if there is a main function

Source: Internet
Author: User

Sometimes, when testing a class, eclipse can be a strange reminder that you can't find the main class. Next there are several workarounds

1. On the project, right click on the > Builder path, Configure Build path, select the source panel and click Add Folder to add the upper directory of the package path where the source code resides, and if you are writing two classes in a file When you right-click the run as Java appication, you want to place the cursor on the class that includes the Main method

2 Copy and paste the class with the main function create a new class copy the code in. OK

3 Rebuilding a Java project directly

If it doesn't work, test Java on the command manager if you don't see if the environment variable is incorrect or reinstalled

Personal homepage: https://blog.pangyd.com/index/article/show/id/56.html

Eclipse cannot find the main class if there is a main function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.