I had two jars in resources folder with that i build my project to jar(say editor.jar
) using maven.
My class File Does not have dependencies to this jars while at building.
But When i run the editor.jar using command java -jar editor.jar
it needs the any one of jar in the lib folder as its dependency.
so i need to add these to jar into the classpath . i read in the same webesite in this question : but it is not worked for me.
My directory looks like this:
what i done so far in 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>editor</groupId>
<artifactId>editor</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<finalName>editor</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>Jdbc</mainClass>
</manifest>
<manifestEntries>
<Class-Path>lib/*.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
How to add the two jars to classpath and make execute the editor.jar ?