how do you do?
I am doing a project and I have to generate a JAR file. When creating the JAr and trying to execute it, it tells me that the main class is not found or has not been loaded.
I have been looking for where my error is, but I cannot find it, in my MANIFEST.MF file I have set the Main-Class:
Manifest-Version: 1.0
Main-Class: AudiSyncTool
And this is my main class:
import make.WindowInterface;
import java.awt.*;
import java.io.IOException;
public class AudiSyncTool {
public static void main(String[] args) throws IOException, AWTException {
if (SystemTray.isSupported()){
WindowInterface windowInterface = WindowInterface.getInstance();
windowInterface.runApp();
}
}
}
And my main class it is at default package.
And in my pom.xml file I have the apache plugin set to generate JAR files.
<build>
<plugins>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>AudiSyncTool</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Any advice or suggestion on how to solve this problem of not being able to generate JAR files correctly?
It goes without saying that when I run the code everything works fine. But not when I generate the JAR.
Thanks.
You need run with -jar java -jar synctoolaudi.jar
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.