javamacosdeploymentversionjavapackager

Broken -Bmac.CFBundleVersion option in javapackager


On macOS, the command-line option -Bmac.CFBundleVersion=<value> specified in the documentation of Oracle javapackager utility does not work.

I am using the following command to create the disk image Application.app from Application.jar:

javapackager \
  -deploy \
  -native image \
  -srcfiles Application.jar \
  -outdir dist \
  -outfile Application \
  -appclass Application \
  -BappVersion=2.0 \
  -Bmac.CFBundleVersion=2.0.0 \
  -BjvmOptions=-Dapple.laf.useScreenMenuBar=true

The popup window opened from the "About Application" item in the menu bar displays the following string:

Application

Version 2.0 (100)

instead of

Application

Version 2.0 (2.0.0)

When I check the generated Application.app/Contents/Info.plist file, I see that javapackager correctly read the command-line option -BappVersion=2.0 to set the value of the key CFBundleShortVersionString, but failed to read the command-line option -Bmac.CFBundleVersion=2.0.0 to set the value of the key CFBundleVersion:

<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleVersion</key>
<string>100</string>

Solution

  • I was using an old version (update 25) of the Java SE Development Kit 8. I downloaded and installed the last version (update 121) from Oracle's website (jdk-8u121-macosx-x64.dmg) and it solved the problem. Thank you @Nicolas Filotto.