Eclipse运行错误的类 [英] Eclipse is running the wrong class

查看:101
本文介绍了Eclipse运行错误的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个类,但在尝试运行时,Eclipse会选择运行另一个类?

I've created a class but while trying to run it Eclipse chooses to run another class I have?

如何更改运行配置以运行类我想要?

How can I change the run configuration to run the class I want?

这只是一些随机测试,以达到质量标准。

This is just some random test to try to meet the quality standards.

推荐答案

运行配置错误。

运行菜单中有一个运行配置选项。这定义了您的项目的各种运行配置。您需要添加一个新的运行任何您感兴趣的。

Under the Run menu there's a Run Configurations option. That defines the various run configs for your projects. You need to add a new one that runs whatever it is you're interested in.

运行配置也可以通过在Java源文件中右键单击来选择运行方式... 运行配置

Run configurations are also accessible by right-clicking in a Java source file, selecting Run As..., and Run Configurations.

一旦你进入运行配置对话框:

Once you're in the run configuration dialog:


  • 如有必要,编辑项目(不会,使用右键单击方法)

  • 输入感兴趣的主要方法所在的课程

  • 给配置一个合理的名称(可选,但方便)

  • edit the project if necessary (it won't be, using the right-click method)
  • enter the class where the main method of interest resides
  • give the configuration a reasonable name (optional, but handy)

现在您有一个方便的方法来选择哪个 main 方法要执行。

Now you have a convenient way of selecting which main method you want to execute.

这篇关于Eclipse运行错误的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆