@@ -971,14 +971,27 @@ void handleClassPathAttribute(LinkedHashSet<Path> destination, Path jarFilePath,
971971 String classPathValue = mainAttributes .getValue ("Class-Path" );
972972 /* Missing Class-Path Attribute is tolerable */
973973 if (classPathValue != null ) {
974+ /* Cache expensive reverse lookup in bundle-case */
975+ Path origJarFilePath = null ;
974976 for (String cp : classPathValue .split (" +" )) {
975977 Path manifestClassPath = Path .of (cp );
976978 if (!manifestClassPath .isAbsolute ()) {
977979 /* Resolve relative manifestClassPath against directory containing jar */
978- manifestClassPath = jarFilePath .getParent ().resolve (manifestClassPath );
980+ Path relativeManifestClassPath = manifestClassPath ;
981+ manifestClassPath = jarFilePath .getParent ().resolve (relativeManifestClassPath );
982+ if (useBundle () && !Files .exists (manifestClassPath )) {
983+ if (origJarFilePath == null ) {
984+ origJarFilePath = bundleSupport .originalPath (jarFilePath );
985+ }
986+ if (origJarFilePath == null ) {
987+ assert false : "Manifest Class-Path handling failed. No original path for " + jarFilePath + " available." ;
988+ break ;
989+ }
990+ manifestClassPath = origJarFilePath .getParent ().resolve (relativeManifestClassPath );
991+ }
979992 }
980993 /* Invalid entries in Class-Path are allowed (i.e. use strict false) */
981- addImageClasspathEntry (destination , manifestClassPath , false );
994+ addImageClasspathEntry (destination , manifestClassPath . normalize () , false );
982995 }
983996 }
984997 }
0 commit comments