如何设置“主类”在“运行配置”在Eclipse中 [英] how to setup "Main Class" in "Run Configurations" in Eclipse

查看:581
本文介绍了如何设置“主类”在“运行配置”在Eclipse中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个Java项目中,有两个java文件有main方法。
这两个java文件的绝对路径是:

  C:\Desktop\project1\src\\ \\com \pre\moveposition1.java 

  C:\Desktop\project1\src\com\pre\moveposition2.java 

当我尝试在运行配置中设置Main Class参数时,应该设置什么?



解决方案

放置包含main的类的(完全限定)名称。例如,如果要使用moveposition2的main(而不是moveposition1),则可以输入:

  com.pre.moveposition2 

此外,点击搜索...应该会列出一些包含main( )方法可以选择。


In a Java project, there have two java files has main method. The absolute paths for these two java files are:

C:\Desktop\project1\src\com\pre\moveposition1.java

And

C:\Desktop\project1\src\com\pre\moveposition2.java

When I try to setup "Main Class" parameter in "Run Configuration", what should I setup?

解决方案

Put the (fully qualified) name of the class containing main. For example, if you want to use moveposition2's main (and not moveposition1's) then you'd enter:

com.pre.moveposition2

Also, clicking on "Search..." should give you a list of classes that contain main() methods that you can choose from.

这篇关于如何设置“主类”在“运行配置”在Eclipse中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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