Eclipse运行错误的类 [英] Eclipse is running the wrong class
问题描述
我创建了一个类,但在尝试运行时,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屋!