Eclipse compiler often appears: editor does not contain a main TYPE SOLUTION

Source: Internet
Author: User
The compiler was good before. debug it today. Program Editor does not contain a main type suddenly appears, it is said that the program does not contain an executable main function, so this situation occurs, but my program has a main function, and previously run Code Now that this is the case, I checked the solution in the evening and shared the following:
Solution: Shut down eclipse and restart eclipse. This is basically the case. I have been entangled for a long time before, and it will be good after doing so.
Solution 2:

The package of this class was not added to build path.

Solution: In package explorer on the left, right-click the upper-level directory of the class package -- Build path -- use as source folder. This solves the problem.

Open the class again and run again. OK.

-----------------------------------------------------
Supplement and explanation:

Ah, okay. Let's give a brief explanation.

In this figure, SRC is in build path (observe the SRC icon carefully)
Relative, resource is just a normal folder, not in build path (the icon is different from SRC ?)
Then, I created a folder and a file under resource. In comparison, the packages and folder icons are also different.

Now, I want to add the resource to the build path. (The method is to right-click resource -- Build path -- use as source folder)

In this way, both SRC and resource are in build path.

Finally, what is "in build path "? You can understand that in eclipse, classes in build path can be compiled and run, and configuration files in build path can be directly read and written by classes in relative paths.

After that, I hope that my colleagues who have problems will be satisfied. I hope that my anger will be mitigated...
Some images cannot be displayed. The course view information is as follows:

Http://hi.baidu.com/zh_m_zhou/blog/item/8bb9ba025baa98e408fa93fd.html

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.