I am using IntelliJ IDEA and Java. I have my main program, named SearchEngine which should build an executable SearchEngine.jar. However, there are dependencies in my code to 3 extra .jar files. I have added those dependencies and my program is working fine.
I want to build an executable .jar that does not include the 3 extra .jar files inside it, but instead, it copies them in a lib folder. For that matter I selected the following option:

When I don't change the settings in the Artifacts project settings tab, I get 4 .jar files, 1 of which is my executable and 3 are the extra .jar files. This way, everything works fine.

However, when I try and add the 3 extra .jar files inside a lib folder, my executable does not work, even though the 3 extra .jars are getting copied in a lib folder. How to make this work ?

Manually editing the MANIFEST.MF file like below (adding libs/ in front of every .jar name), fixed it.
Before:
Class-Path: lucene-core-4.10.2.jar lucene-queryparser-4.10.2.jar lucen
e-analyzers-common-4.10.2.jar
After:
Class-Path: libs/lucene-core-4.10.2.jar libs/lucene-queryparser-4.10.2.jar
libs/lucene-analyzers-common-4.10.2.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With