I am creating a Discord Server Bot and when I build and execute jar file it says
Error
C:Users[user.name]IdeaProjectsJava-Discord-Botarget>java -jar "Java-Discord-Bot-1.0 V.jar"
Error: Could not find or load main class discord.java.bot.JavaDiscordBot
Here is my POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>discord.java.bot</groupId>
<artifactId>Java-Discord-Bot</artifactId>
<version>1.0 V</version>
<packaging>jar</packaging>
<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>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>discord.java.bot.JavaDiscordBot</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<artifactId>JDA</artifactId>
<groupId>net.dv8tion</groupId>
<version>4.2.0_226</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
</project>
Command for making JAR
mvn package
Output for packing files
C:Users[user.name]IdeaProjectsJava-Discord-Bot>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< discord.java.bot:Java-Discord-Bot >------------------
[INFO] Building Java-Discord-Bot 1.0 V
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Java-Discord-Bot ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Java-Discord-Bot ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Java-Discord-Bot ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:Users[user.name]IdeaProjectsJava-Discord-Botsrcest
esources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Java-Discord-Bot ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Java-Discord-Bot ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) @ Java-Discord-Bot ---
[INFO] Building jar: C:Users[user.name]IdeaProjectsJava-Discord-BotargetJava-Discord-Bot-1.0 V.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.535 s
[INFO] Finished at: 2021-01-11T13:21:58+05:00
[INFO] ------------------------------------------------------------------------
C:Users[user.name]IdeaProjectsJava-Discord-Bot>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…