If you write some class, compile into a jar, but in the execution of this jar error, can not find the main class, but you obviously have, is not very depressed, check your jar bar.
Unzip your jar, open meta-inf This folder, open MANIFEST.MF This file (this is a text), see if there is no main-class:myclass, if not, add in, remember to write the path correctly, such as Com.sun.mytest.Myclass, so as to find, and then re-hit the jar, if you do not want to be so troublesome, it is to compile the jar when you remember to write this in the OH.
The most common is that you need to add the following configuration file in the Pom to solve the problem
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.test.FirstTest</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Java-jar Test.jar cannot find the main class problem