user288609 user288609 - 2 months ago 5
Java Question

how to setup "Main Class" in "Run Configurations" in Eclipse

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?

enter image description here

Answer

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.