Answer:
Each Java project in Eclipse (and STS also) has an associated build path where it indicates which folders in the project contain java classes. Thus, the difference between src/ and src/main/java is that src/main/java configured as a folder containing java classes (or the source folder in Eclipse terminology), while the src/ folder contains only the source folder.
More information can be found in the Eclipse Help .
I'm not sure what caused your Java classes to end up in the wrong folder, but that means they are not in the classpath of the project. Therefore, when you run the application as a Java application, it complains that it cannot find the main() method (which is the default entry point for any Java application).
Everything falls into place when you move your classes under the default package in src/main/java : Eclipse finds your Java classes and the main() method.
source share