Eclipse 简明教程

Eclipse - Running Program

Running a Java Program

运行 Java 程序的最快方法是使用包资源管理器视图。

The quickest way to run a Java program is by using the Package Explorer view.

在包资源管理器视图中:

In the Package Explorer view −

  1. Right click on the java class that contains the main method.

  2. Select Run As → Java Application.

还可以使用“包资源管理器”视图执行相同操作,方法是选择包含 main 方法的类并单击 Alt + Shift + X,J。

The same action can be performed using the Package Explorer view by selecting the class that contains the main method and clicking Alt + Shift + X, J.

上面提到的任一操作都会新建一个 Run Configuration 并使用它来启动 Java 应用程序。

Either actions mentioned above create a new Run Configuration and use it to start the Java application.

如果已创建运行配置,则可以选择“运行”菜单中的“运行配置”,单击运行配置的名称,然后单击“运行”按钮,以使用该配置启动 Java 应用程序。

If a Run configuration has already been created you can use it to start the Java application by selecting Run Configurations from the Run menu, clicking on the name of the run configuration and then clicking on the Run button.

run program 1

可以从 Run 菜单使用 Run 项来重启之前启动的 Java 应用程序。

The Run item on the Run menu can be used to restart the java application that was previously started.

run program 2

启动先前已启动的 Java 应用程序的快捷键是 Ctrl + F11。

The shortcut key to launch the previously launched Java application is Ctrl + F11.