src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java
branchJDK-8200758-branch
changeset 57218 8018ecf829bc
parent 57213 8ff0a29bf9bc
child 57256 d7c27451f759
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java	Wed Feb 27 08:53:56 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java	Wed Feb 27 19:45:26 2019 -0500
@@ -29,6 +29,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.nio.file.Path;
 import java.text.MessageFormat;
 import java.util.Arrays;
 import java.util.Collection;
@@ -118,14 +119,23 @@
             if (appName == null) {
                 // Use WIN_APP_IMAGE here, since we already copy pre-defined
                 // image to WIN_APP_IMAGE
-                File appImageDir = new File(
-                        WIN_APP_IMAGE.fetchFrom(p).toString() + "\\app");
-                File [] files = appImageDir.listFiles(
+                File appImageDir = WIN_APP_IMAGE.fetchFrom(p);
+
+                File appDir = new File(appImageDir.toString() + "\\app");
+                File [] files = appDir.listFiles(
                         (File dir, String name) -> name.endsWith(".cfg"));
                 if (files == null || files.length == 0) {
-                    throw new RuntimeException(MessageFormat.format(
-                        I18N.getString("error.cannot-find-launcher"),
-                        appImageDir));
+                    String name = APP_NAME.fetchFrom(p);
+                    Path exePath = appImageDir.toPath().resolve(name + ".exe");
+                    Path icoPath = appImageDir.toPath().resolve(name + ".ico");
+                    if (exePath.toFile().exists() &&
+                            icoPath.toFile().exists()) {
+                        return name;
+                    } else {
+                        throw new RuntimeException(MessageFormat.format(
+                                I18N.getString("error.cannot-find-launcher"),
+                                appImageDir));
+                    }
                 } else {
                     appName = files[0].getName();
                     int index = appName.indexOf(".");