1

I have copied this example from here, but I am having trouble making to work.

mkdir -p package/macosx
cp you_icon_app.icns package/macosx 
jdk=$(/usr/libexec/java_home)
$jdk/bin/javapackager -version
$jdk/bin/javapackager -deploy -native dmg \
   -srcfiles you_app.jar -appclass you_app_name -name you_app_name \
   -outdir deploy -outfile you_app_name -v
cp deploy/bundles/you_app_name-1.0.dmg you_app_name-installer.dmg

When I use it, I get this message:

Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.

Community
  • 1
  • 1
JavaLatte
  • 378
  • 5
  • 18

1 Answers1

0

I found the problem. If you run Javapackager, on completion it leaves the output DMG open: the next time you try, it fails because it can't create a DMG (it's already open!).

If you look in Finder, you will find a section labelled Devices on the left: any open DMGs will appear here. You can close them by clicking the Eject symbol next to them.

Another problem I had is that I mistakenly assumed that Textedit was a text editor, and would be suitable for editing the shell script I was using to run javapackager. It's not. It sneakily changes dashes to hyphens (they look the same, but javapackager does't like them) and if you use double-quotes, it changes the second of each pair to a reverse-quote. Java packager doesn't like those either.

JavaLatte
  • 378
  • 5
  • 18