Java Packager fails to create macOS or Windows Bundle

Dmitry Beloborodov dbelob.openjdk at gmail.com
Mon Oct 9 15:52:29 UTC 2017


There is JDK-8179033
https://bugs.openjdk.java.net/browse/JDK-8179033
("javapackager fails to create Mac Application Bundle")

Error is reproduced on macOS and Windows
(there is no error on Linux)

Cause is the absence of a destination resource subdirectory.

I suppose that to fix the error it is enough to create subdirectories
before copying of destination resources
(see correct methods
com.oracle.tools.packager.windows.WinAppBundler::copyApplication in Java 8
com.oracle.tools.packager.mac.MacAppBundler::copyClassPathEntries in Java 8
com.oracle.tools.packager.linux.LinuxAppBundler::copyApplication in Java 8
or
jdk.packager.builders.linux.LinuxAppImageBuilder::copyApplication in Java 9
)

To fix it (in Java 9) you need to
1. Change in
jdk.packager.builders.windows.WindowsAppImageBuilder::copyApplication method
from
   for (String fname : appResources.getIncludedFiles()) {
      Files.copy(new File(srcdir, fname).toPath(), new
File(appDir.toFile(), fname).toPath());
   }
to
   for (String fname : appResources.getIncludedFiles()) {
      File destFile = new File(appDir.toFile(), fname);

      destFile.getParentFile().mkdirs();
      Files.copy(new File(srcdir, fname).toPath(), destFile.toPath());
   }

2. Change in jdk.packager.builders.mac.MacAppImageBuilder::copyApplication
method
from
   for (String fname : classPath.getIncludedFiles()) {
      // use new File since fname can have file separators
      Files.copy(new File(srcdir, fname).toPath(), new
File(javaDirectory.toFile(), fname).toPath());
   }
to
   for (String fname : classPath.getIncludedFiles()) {
      // use new File since fname can have file separators
      File destFile = new File(javaDirectory.toFile(), fname);

      destFile.getParentFile().mkdirs();
      Files.copy(new File(srcdir, fname).toPath(), destFile.toPath());
   }

Please fix error. Many thanks!

With best regards,
Dmitry Beloborodov


More information about the openjfx-dev mailing list