jpackage custom resources not found

Andy Herrick andy.herrick at
Tue Jan 15 14:11:52 UTC 2019

On 1/15/2019 12:08 AM, Kustaa Nyholm wrote:
> Seems to work not! Thanks!
> Some small quibbles:
> The build directory is not kept or used:
> Using default package resource Runtime-Info.plist.template [Java Runtime Info.plist]  (add Runtime-Info.plist to the resource-dir to customize)
> Kept working directory for debug: /Users/nyholku/EazyCNC-Project/abuildroot
> MacBook-Pro:EazyCNC-Project nyholku$ ls /Users/nyholku/EazyCNC-Project/abuildroot
> ls: /Users/nyholku/EazyCNC-Project/abuildroot: No such file or directory
On Mac and Linux, no resources are added to the --build-root dir when 
running in mode "create-image", so no dir is created.  It is a probably 
a bug that the verbose statement "Kept ..." is printed when that dir is 
> Also, what is 'Runtime-Info.plist.template' and why would I want it?

The default 'Runtime-Info.plist.template' in jpackage macosx resources is:

> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
> "">
> <plist version="1.0">
> <dict>
>         <key>CFBundleDevelopmentRegion</key>
>         <string>English</string>
>         <key>CFBundleExecutable</key>
>         <string>libjli.dylib</string>
>         <key>CFBundleIdentifier</key>
>         <string>CF_BUNDLE_IDENTIFIER</string>
>         <key>CFBundleInfoDictionaryVersion</key>
>         <string>7.0</string>
>         <key>CFBundleName</key>
>         <string>CF_BUNDLE_NAME</string>
>         <key>CFBundlePackageType</key>
>         <string>BNDL</string>
>         <key>CFBundleShortVersionString</key>
>         <key>CFBundleSignature</key>
>         <string>????</string>
>         <key>CFBundleVersion</key>
>         <string>CF_BUNDLE_VERSION</string>
> </dict>
> </plist>
The values for the keys CF_BUNDLE_IDENTIFIER, CF_BUNDLE_NAME, 
from the information available to jpackage, to create the apps 
Contents/Info.plist .

> I take it jpackage is not going to build the .dmg and I have to this with standard MacOs tools?
> Ok I already do that as the old javapackager generated .dmg did not have the properties I liked
> and now way to influence those.

Running jpackage in "create-image" mode only creates the application , 
to create an installer (pkg or dmg on Mac) use mode "create-installer"

You can do this all in one step "${PACKAGER} create-installer dmg 
<options>" or in multiple steps using the --app-image option in the 
create-installer mode to point to an image created by running jpackage 
in the create-image mode.  By using two steps you may be able to 
customize the .dmg by modifying the image created by the first step.   
You may also be able to influence the properties you like by using 
--resource-dir to override resources used bu the installer (note 
--build-root dir will be created and kept in create-installer mode even 
on Mac)


> For reference and posterity in case anyone comes hear searching for a worked out sample here is my simplistic test script:
> #!/bin/bash
> set -e
> PACKAGER=/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home/bin/jpackage
> ${PACKAGER} --version
> create-image \
> --force \
> --build-root abuildroot \
> --verbose \
> --add-modules java.base,java.desktop,,java.sql,java.instrument,java.compiler \
> --input buildtest \
> --output . \
> --name EazyCNC \
> --main-jar EazyCNC.jar \
> --class eazycnc.Main \
> --jvm-args '-Xmx1024m -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+PrintGC' \
> --resource-dir 'javapackager-resources/package/macosx'
> 'buildtest' is a flat directory that contains all my jars, I will next
> figure out if has to be flat or what ever other ways I can use to
> organise it better or specify the jars more rationally but as a starting
> point that produces correct .app above seems to work for my case.
> wbr Kusti

More information about the core-libs-dev mailing list