且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ECLIPSE:错误:在类apple中找不到主要方法,请将该主要方法定义为:public static void main(String [] args)

更新时间:2022-06-07 05:58:16

您需要选择要运行的Java应用程序:右键单击项目的根目录,运行方式>运行配置.

You need to select your Java Application to be run: Right-click on your project root directory, Run As > Run Configurations.

在左侧选择Java应用程序,如果"Java应用程序"下有一个Configuration,则选择它(如果未创建).然后在主要"选项卡下,选择搜索并在您的项目中找到主要类.

On the left-side select Java Application, if there is a Configuration under 'Java Application', then select it, if not create it. Then under the 'Main' tab, select search and find the Main class in your project.

然后选择运行.

失败的其他原因:

  • 在运行之前未保存项目.
  • Eclipse故障,请尝试重新启动.