What is the difference between src / main / java and src in Springsource tool

I am exploring the use of the Springsource Tool Suite (STS) and Spring framework for development. I am trying to run the Amazon AWS SDK for eclipse and decided to install it in STS. When I follow the creation of a new AWS project, it puts the .java file in src instead of src / main / java, and when I try to build it, it says

"No core" or something like that.

But when I move AwsConsoleApp.java and AwsCredentials.properties to src / main / java, then (by default) I can run the file as a Java application.

My question is what is the difference between src/main/java standard package and src -> main. I added an image to clarify the situation:

Project_Explorer_View

+4
source share
1 answer

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.

+5
source

All Articles