I've build the following jar (test.jar) with maven:
/META-INF
MANIFEST.MF
/com
/some classes
Here is the content of MANIFEST.MF:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Class-Path: lib/db2jcc.jar
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_71
Main-Class: Main
As you can see I need a DB2 Driver to run my jar, so I put my librairies with the jar:
test.jar
/lib
db2jcc.jar
I can run my executable with this command line:
java -cp "test.jar;lib/db2jcc.jar" Main
I would like to run it with the following ommand line:
java -jar test.jar
And the result is java.lang.NoClassDefFoundError: com/ibm/db2/jcc/DB2Driver
. It looks like the lib folder is not read despite of my MANIFEST.MF. Does someone know what I am doing wrong?
Thanks in advance for your help.