Eclipse/myeclipse method to resolve editor does not contain a main type

Source: Internet
Author: User
Written in front of the words: I also appear this problem, but the solution and forwarding the content is not the same, the principle is the same, I am right click Src--build path--use as source folder, and then remove source folder on the line, remember to run after the restart, And the package is estimated to rebuild source again.

Today, with Eclipse, when you intend to run a class with the main function, an error box appears editor does not contain a main type.
      
Eclipse/myeclipse There is a main function class running an error: Editor does not contain a main type

Workaround: In the Package Explorer on the left, right-click the directory at the top level of this class's package--build Path--use as source folder. That will solve the problem.

This problem occurs because the package that contains the Java file is not identified by MyEclipse as the source package. The processing method is as follows:



1. Open the Java Build Path window and select the source interface:



2. Click Add Folder, select the root package of the class in the dialog box, and the latter point determines:


3. After clicking OK and waiting for the workspace to build, the project looks like the following figure, which is success:




5. The file entrainment "field" icon is successful, now, you can run the main way to change the class.
Finally, explain what is called "in Build Path." You can understand that, in eclipse, classes in the build path can be compiled and run, and profiles can be read and written directly by classes in relative paths.

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.