--- old/modules/jdk.packager/src/main/java/jdk/packager/internal/legacy/builders/windows/WindowsAppImageBuilder.java 2017-12-12 18:19:33.000000000 -0800 +++ new/modules/jdk.packager/src/main/java/jdk/packager/internal/legacy/builders/windows/WindowsAppImageBuilder.java 2017-12-12 18:19:33.000000000 -0800 @@ -49,6 +49,7 @@ import java.nio.file.Path; import java.nio.file.attribute.PosixFilePermission; import java.text.MessageFormat; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -84,6 +85,50 @@ private static final String EXECUTABLE_PROPERTIES_TEMPLATE = "WinLauncher.properties"; + List API_MS_DLLS = Arrays.asList( + "api-ms-win-core-console-l1-1-0.dll", + "api-ms-win-core-datetime-l1-1-0.dll", + "api-ms-win-core-debug-l1-1-0.dll", + "api-ms-win-core-errorhandling-l1-1-0.dll", + "api-ms-win-core-file-l1-1-0.dll", + "api-ms-win-core-file-l1-2-0.dll", + "api-ms-win-core-file-l2-1-0.dll", + "api-ms-win-core-handle-l1-1-0.dll", + "api-ms-win-core-heap-l1-1-0.dll", + "api-ms-win-core-interlocked-l1-1-0.dll", + "api-ms-win-core-libraryloader-l1-1-0.dll", + "api-ms-win-core-localization-l1-2-0.dll", + "api-ms-win-core-memory-l1-1-0.dll", + "api-ms-win-core-namedpipe-l1-1-0.dll", + "api-ms-win-core-processenvironment-l1-1-0.dll", + "api-ms-win-core-processthreads-l1-1-0.dll", + "api-ms-win-core-processthreads-l1-1-1.dll", + "api-ms-win-core-profile-l1-1-0.dll", + "api-ms-win-core-rtlsupport-l1-1-0.dll", + "api-ms-win-core-string-l1-1-0.dll", + "api-ms-win-core-synch-l1-1-0.dll", + "api-ms-win-core-synch-l1-2-0.dll", + "api-ms-win-core-sysinfo-l1-1-0.dll", + "api-ms-win-core-timezone-l1-1-0.dll", + "api-ms-win-core-util-l1-1-0.dll", + "api-ms-win-crt-conio-l1-1-0.dll", + "api-ms-win-crt-convert-l1-1-0.dll", + "api-ms-win-crt-environment-l1-1-0.dll", + "api-ms-win-crt-filesystem-l1-1-0.dll", + "api-ms-win-crt-heap-l1-1-0.dll", + "api-ms-win-crt-locale-l1-1-0.dll", + "api-ms-win-crt-math-l1-1-0.dll", + "api-ms-win-crt-multibyte-l1-1-0.dll", + "api-ms-win-crt-private-l1-1-0.dll", + "api-ms-win-crt-process-l1-1-0.dll", + "api-ms-win-crt-runtime-l1-1-0.dll", + "api-ms-win-crt-stdio-l1-1-0.dll", + "api-ms-win-crt-string-l1-1-0.dll", + "api-ms-win-crt-time-l1-1-0.dll", + "api-ms-win-crt-utility-l1-1-0.dll", + "msvcr120.dll", + "ucrtbase.dll"); + private final Path root; private final Path appDir; private final Path runtimeDir; @@ -284,7 +329,8 @@ AtomicReference ioe = new AtomicReference<>(); final String finalVsVer = vsVer; - try (Stream files = Files.list(runtimeDir.resolve("bin"))) { + final Path bin = runtimeDir.resolve("bin"); + try (Stream files = Files.list(bin)) { files.filter(p -> Pattern.matches("(vcruntime|msvcp)\\d\\d\\d.dll", p.toFile().getName().toLowerCase())) .filter(p -> !p.toString().toLowerCase().endsWith(finalVsVer + ".dll")) .forEach(p -> { @@ -296,6 +342,14 @@ }); } + API_MS_DLLS.forEach(fileName -> { + try { + Files.copy(bin.resolve(fileName), root.resolve(fileName)); + } catch (IOException e) { + ioe.set(e); + } + }); + IOException e = ioe.get(); if (e != null) { throw e;