This is implied as a standard for determining unique locations for Java source code. This is consistent with this package structure, so you see it everywhere. You donβt need to do this - you can name your packages as you like. However, this agreement should be observed very often.
package prefix.organization.project.ClassName;
package prefix.organization.project.package.ClassName;
package prefix.organization.project.package.subpackage.ClassName;
When storing Java source code files, each part of the package name is translated into a subdirectory. Thus, the same three classes shown above will be located in the corresponding directories from the main class path.
prefix / organization / project / ClassName.java
prefix / organization / project / package / ClassName.java
prefix / organization / project / package / subpackage / ClassName.java
When compiling manually, make sure that the main directory of the path classes is the current directory or is inside the class path so that the source code files can be found.
As for the src/main/java , it seems to come from Maven. I have never used this software. I donβt understand why they need so much, because my projects (I use Eclipse) instead have the src folder instead.
source share