editor does not contain a main type的解决方案[ZT]

转自:http://hi.baidu.com/zh_m_zhou/blog/item/8bb9ba025baa98e408fa93fd.html
作者:pocky

今天用eclipse,当打算run一个带有main函数的class时,出现editor does not contain a main type的错误框。

baidu了一下,迅速解决问题:原来这个class所在包没有被添加到build path中。

解决方法:在左侧的package explorer中右击这个class所在包的上一级目录--build path--use as source folder。这样就解决问题了。

重新打开class,再run一下,ok了。

原文地址:https://www.cnblogs.com/lionfight/p/2603875.html