Java - editor does not contain the main type

Possible duplicate:
Eclipse Error: "The editor does not contain the main type"

I am currently encoding a server socket application where you can connect to multiple clients through a thread pool.

But when I want to compile the main one, I get:

enter image description here

Why do I understand this? I still have a main one in my mainServer.java

I appreciate your answer !!!

+4
source share
4 answers

Make sure your launch configuration is set to ServerMain, and if it is not, make sure you run Run As > Java Application .

Otherwise, you can try Project > Clean

There are also a few more questions that concern this, which may be useful . Eclipse error: "The editor does not contain the main type." The editor does not contain the main type.

+2
source

Make sure the project source folder (src) is on the build path. If not, the main () method may not be included in your project. You can follow these steps to check your source path settings:

  • Right click on your project with Package Explorer .
  • Select Properties (ALT + Enter)
  • Go to the Java Build Path Click tab on the Source tab and check if the source folder is on the build path.

Once verification is complete, you can close your project and reopen it. Then you can right-click the class file using the main method ( ServerMain.java in your case ) and run it.

+4
source

You can configure your main class (should be static for my understanding) in the project properties.

Make sure it points to the right place.

http://protegewiki.stanford.edu/images/2/24/Protege41InEclipseRunnableMainTab.png

0
source

I also encountered this problem several times, I use a workaround for this.
go to the package explorer, and then go to the desired class (the class under the .java file), right-click and run as a java application

0
source

Source: https://habr.com/ru/post/1439557/


All Articles