It seems for executable jar files under OpenJDK 11, the classpath specified in the jar manifest is statically based on a snapshot taken at startup time. So even though we download the dependencies so that they should be found on the classpath, we get ClassNotFoundExceptions like below. The second CLI run succeeds since the dependencies are already in place.
Downloading cli/lib/org.eclipse.jgit.lfs-4.8.0.201706111038-r.jar...
Downloading cli/lib/commons-logging-1.2.jar...
Downloading cli/lib/org.eclipse.jgit.pgm-4.8.0.201706111038-r.jar...
Downloading cli/lib/org.eclipse.jgit.ui-4.8.0.201706111038-r.jar...
Downloading cli/lib/org.eclipse.jgit-4.8.0.201706111038-r.jar...
Downloading cli/lib/httpcore-4.4.7.jar...
Downloading cli/lib/httpclient-4.5.3.jar...
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jgit/lib/AnyObjectId
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.centurylink.mdw.cli.Git.invokeVersionControl(Git.java:103)
at com.centurylink.mdw.cli.Git.run(Git.java:85)
at com.centurylink.mdw.cli.Vercheck.compareVersions(Vercheck.java:155)
at com.centurylink.mdw.cli.Vercheck.run(Vercheck.java:109)
at com.centurylink.mdw.cli.Vercheck.run(Vercheck.java:36)
at com.centurylink.mdw.cli.Main.main(Main.java:104)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.lib.AnyObjectId
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
It seems for executable jar files under OpenJDK 11, the classpath specified in the jar manifest is statically based on a snapshot taken at startup time. So even though we download the dependencies so that they should be found on the classpath, we get ClassNotFoundExceptions like below. The second CLI run succeeds since the dependencies are already in place.