JDK-8188763 : icns file not found error with javapackager on macOS High Sierra
  • Type: Bug
  • Component: deploy
  • Sub-Component: packager
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2017-10-02
  • Updated: 2017-12-09
  • Resolved: 2017-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin Comet.local 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

EXTRA RELEVANT SYSTEM CONFIGURATION :
macOS High Sierra
Version 10.13
MacBook (Retina, 12-inch, Early 2016)

A DESCRIPTION OF THE PROBLEM :
javapackager command crashes out with:

ERROR: File Not Found. (-43) on file: /var/folders/c1/hkb.../images/ShowTime/.VolumeIcon.icns

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
curl --remote-name http://centerkey.com/mac/java/ShowTime.java
javac ShowTime.java
echo "Main-Class: ShowTime" > MainClass.txt
jar cmf MainClass.txt ShowTime.jar *.class
jdk=$(/usr/libexec/java_home)
$jdk/bin/javapackager -deploy -native dmg -name ShowTime \
   -srcdir . -srcfiles ShowTime.jar -appclass ShowTime \
   -outdir deploy -outfile ShowTime -v

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
New file generated:
deploy/ShowTime-1.0.dmg
ACTUAL -
Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Running [/usr/bin/SetFile, -c, icnC, /var/folders/c1/hkb5ph9s7l352nhr17n310vc0000gn/T/fxbundler10109585143778151656/images/ShowTime/.VolumeIcon.icns]
ERROR: File Not Found. (-43)  on file: /var/folders/c1/hkb5ph9s7l352nhr17n310vc0000gn/T/fxbundler10109585143778151656/images/ShowTime/.VolumeIcon.icns 
java.io.IOException: Exec failed with code 2 command [[/usr/bin/SetFile, -c, icnC, /var/folders/c1/hkb5ph9s7l352nhr17n310vc0000gn/T/fxbundler10109585143778151656/images/ShowTime/.VolumeIcon.icns] in unspecified directory
    at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:169)
    at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:142)
    at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:136)
    at jdk.packager/com.oracle.tools.packager.mac.MacDmgBundler.buildDMG(MacDmgBundler.java:391)
    at jdk.packager/com.oracle.tools.packager.mac.MacDmgBundler.bundle(MacDmgBundler.java:92)
    at jdk.packager/com.oracle.tools.packager.mac.MacDmgBundler.execute(MacDmgBundler.java:549)
    at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:371)
    at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
    at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)
Config files are saved to /var/folders/c1/hkb5ph9s7l352nhr17n310vc0000gn/T/fxbundler10109585143778151656/macosx. Use them to customize package.
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.
    at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374)
    at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
    at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.Date;
import javax.swing.*;

public class ShowTime {

   public static void main(String[] args) {
      JFrame f = new JFrame();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setTitle("It's Showtime!");
      f.getContentPane().add(new JLabel(new Date().toString()));
      f.pack();
      f.setVisible(true);
      }

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None.

The javapackager command worked correctly on macOS Sierra (10.12).

The provided steps are a subset of a tutorial I maintain about how to create a macOS installer for a Java application.

Tutorial:
http://centerkey.com/mac/java

Full list of steps:
http://centerkey.com/mac/java/commands.txt


Comments
Adding workaround as shared by the submitter: ======================================= While the "-native dmg" option is broken, the "-native pkg" option works fine. It produces a ".pkg" installer file instead of a ".dmg" disk image, but an installer file is a desired result for many situations.
05-12-2017

MAC OS X 10.13 JDK 9 Result with JDK 9 ===================== Checked with JDK 9 in MAC OS X 10.12.6 and could confirm the issue. Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "DMG Installer" (dmg) failed to produce a bundle. at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374) at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348) at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496) To verify run the following steps: 1. Compile the attached test program (ShowTime.java) $ javac ShowTime.java 2. Make executable jar $ echo "Main-Class: ShowTime" > MainClass.txt $ jar cmf MainClass.txt ShowTime.jar *.class 3. Create application icon. Use attached sample image, ShowTime.png and resize to appropriate dimension ofan icon. Convert it into .icns format. $ mkdir ShowTime.iconset sips -z 128 128 ShowTime.png --out ShowTime.iconset/icon_128x128.png $ iconutil --convert icns ShowTime.iconset $ ls -l Note: Ignore the Missing image for variant warnings. 4. Build MAC OS X application with installer: $ mkdir -p package/macosx $ cp ShowTime.icns package/macosx $ jdk=$(/usr/libexec/java_home) $ jdk/bin/javapackager -version $ jdk/bin/javapackager -deploy -native dmg -name ShowTime -srcdir . -srcfiles ShowTime.jar -appclass ShowTime -Bicon=package/macosx/ShowTime.icns -outdir deploy -outfile ShowTime -v $ cp deploy/ShowTime-1.0.dmg show-time-installer.dmg
04-10-2017