Error in running Java class: main class not found or cannot be loaded
resolvent:
1 close the current project
2 delete the. Idea folder of this project
3 reopen the project
that will do
Error in running Java class: main class not found or cannot be loaded
resolvent:
1 close the current project
2 delete the. Idea folder of this project
3 reopen the project
that will do
In this case, change Error to Warning:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JAVA_HOME}/bin/javac</executable>
</configuration>
</plugin>
${JAVA8_HOME} (${JAVA8_HOME}, ${JAVA8_HOME})
The ${JAVA8_HOME} variable is configured in settings.xml as follows:
<profile>
<id>custom-compiler</id>
<properties>
<JAVA8_HOME>C:\Program Files (x86)\Java\jdk1.8.0_73</JAVA8_HOME>
</properties>
</profile>
Of course this should be enabled, so the settings.xml file should also have the following configuration:
<activeProfiles>
<activeProfile>custom-compiler</activeProfile>
</activeProfiles>
Maven has a default repository. M2 repository and a default settings.xml configuration file. This default settings.xml file also adds a JAVA_HOME variable, and the compile is completed. If you are using the MVN package command in the CMD window, you are not using the settings.xml in idea. You are using the settings.xml in E: Tools\ maven \conf. You are using the Settings in E: Tools\ maven \conf. Because there is no default configuration to compile using the 1.8 version of the JDK, the JAVA_HOME could not be found before, resulting in a compilation failure.
Modify compile-time rules
1. Open the project Settings
2. Check the Enable Annotation Processing
box
2. Step one cannot solve can try to reload the lombok plugin
I met question is normal to write code, you can use @ Data annotations provide the get/set methods, but unable to compile program, an error is as follows:
ultimately comes down to the choice of the compiler, switch from eclipse for javac, problem solving.
IntelliJ IDEA newly imported project, the project code did not report an error, but during the compilation process, there will be similar errors, such as missing code format, etc.
A few days boot, suddenly found that their project yesterday can run, today because of the green note floating red and can not run, very embarrassing;
The solution is as follows:
1. Search for “Javadoc” in the setting of IDEA
2. Change the red warning in the Declaration has problem in Javadoc issues to yellow warning;
Basically, the problem with the green comment floating red is solved;