< prev index next >

modules/jdk.packager/src/main/java/jdk/packager/internal/JLinkBundlerHelper.java

Print this page

        

@@ -28,10 +28,11 @@
 
 import com.oracle.tools.packager.StandardBundlerParam;
 import com.oracle.tools.packager.BundlerParamInfo;
 import com.oracle.tools.packager.RelativeFileSet;
 import com.oracle.tools.packager.Log;
+import com.oracle.tools.packager.Platform;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;

@@ -238,10 +239,31 @@
         List<Path> modulePath = StandardBundlerParam.MODULE_PATH.fetchFrom(params);
         Path javaBasePath = findPathOfModule(modulePath, "java.base.jmod");
 
         if (javaBasePath != null && javaBasePath.toFile().exists()) {
             result = javaBasePath.getParent();
+
+            // On a developer build the JDK Home isn't where we expect it
+            // relative to the jmods directory. Do some extra
+            // processing to find it.
+            if (result != null) {
+                boolean found = false;
+                Path bin = result.resolve("bin");
+
+                if (Files.exists(bin)) {
+                    final String exe = (Platform.getPlatform() == Platform.WINDOWS) ? ".exe" : "";
+                    Path javaExe = bin.resolve("java" + exe);
+
+                    if (Files.exists(javaExe)) {
+                        found = true;
+                    }
+                }
+
+                if (!found) {
+                    result = result.resolve("..\\jdk");
+                }
+            }
         }
 
         return result;
     }
 
< prev index next >