How does the Class-path in the MANIFEST.MF file determine the relative location?
1)
Say I have a JAR with a jar inside lib/somejar.jar
and ofc the manifest file is inside META-INF/MANIFEST.MF
. How would I set the classpath....? Would it be Class-path: lib/somejar.jar
or ../lib/somejar.jar
?
2)
Let's say the somejar.jar also has other jars inside of it that the main jar depends on. And of course somejar.jar also has its own MANIFEST.MF file with a correctly set Class-path field. Now lets then say that the original main jar file, during run-time, needs to access one of those JAR files, will it be able to do so as long as somejar.jar is on main.jar's classpath? Or are the relative directories messed up since the main jar is running 'somejar.jar' isn't the root anymore?
minor update: This will all run in a web environment, on an application server.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…