简体   繁体   中英

Run two classes with main in one project

I am using eclipse and I have two classes with main methods.I want to be able when i click right click on each of them and click on "Java application" both to start in a different console.The problem I face is that the first class gets successfully started while when starting the second class it gives me error in eclipse GUI : Selection does not contain main type.When i check the second class configuration i see that it points me to the first class run configuration.It seems that in the "Run Configuration" menu you can set only 1 main class for a project.

I have tried creating 2 run configurations for each class in the project,however it still gives me error when I start a second class with main method.Any ideas how to solve this?

Here is how it looks , I have started the ClientStart.java with main and I went to check the SeverStart which I will execute next : https://imgur.com/a/2yQ1kQl and when I run it I get :  https://imgur.com/a/QLHiPy6

https://pastebin.com/eHDGnY5W -SeverStart

https://pastebin.com/Kd6eRgPW -ClientStart

Run configurations activated itself when you select one class having main method. It ran in my case when I rebuild the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM