编辑器不包含Eclipse中的主要类型

问题描述:

我下载了 eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz 。这个eclipse是内置的java和我的Lubuntu是64位。每当我在java编译并运行一个简单的代码,如下所示:

I downloaded eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz. This eclipse is built-in with java and my Lubuntu is 64-bit. Whenever I compile and run a simple code in java like this one below:

public class Sample{

   public static void main(String[] args){
       System.out.println("YOLO");
   }
}

我总是得到一个编辑器不包含主要类型
我将文件放在名为 Sample 的项目文件夹中。这个eclipse应该编译java代码,因为它是一个专门针对java的IDE分发。

I always get an Editor does not contain a main type. I put the file in a project folder called Sample. This eclipse should compile java code because its an IDE distribution specialized for java.

我如何解决这个错误?

任何帮助将不胜感激。

这是我的项目结构:

Here's my project structure:

我怀疑问题是Sample.java应该在在src文件夹中的一个包。

I suspect the problem is that Sample.java should be in a package inside the src folder.

我猜,eclipse不会自动在外面看。

I guess that eclipse will not automatically look outside of there.