Why should I provide a library in two places when deploying an executable jar?

63 views Asked by At

I have three java classes, a, b, and c in the current working folder.

Class c needs a library(library.jar) in sub-folder called lib. So I have folder structure as follows…

a.class
b.class
c.class
lib/library.jar

To create the MANIFEST.MF I create MANIFEST.TXT with two standard key/value pairs…

Main-Class: a
Class-Path: lib/library.jar

To create an executable jar, with MANIFEST.MF, I do the command…

jar cvfm executable.jar MANIFEST.TXT *.class lib/library.jar

The command above means executable.jar contains my classes and lib/library.jar (i.e. the complete folder structure within it).

But to deploy executable.jar, you have to have the executable.jar as well as create an external folder, lib with library.jar in it, i.e.

lib/library.jar
executable.jar

INSTEAD OF just the executable only…

executable.jar

Isn’t there a programmatical way to make java search in the path already within the excutable jar itself ???

0

There are 0 answers