I’m creating an installable bundle for a JavaFX 8 application using the Oracle tool that comes with the JDK. On a Mac a .dmg
file is created and on Linux a .deb
file is used. I call an Ant script from Gradle to create the bundle. The problem that I have is that the version number contained in the bundle is always 1.0 and not the version that I specify. The relevant part of the Ant script is as follows:
<project name="VocabHunter Packaging" basedir=""
xmlns:fx="javafx:com.sun.javafx.tools.ant">
<target name="jfxbundle" description="Build the application bundle">
<fx:deploy outdir="${basedir}/build"
nativeBundles="${packageType}">
<fx:application refId="VocabHunterId"
version="${version}"/>
<fx:bundleArgument arg="mac.CFBundleVersion"
value="${version}"/>
...
</fx:deploy>
...
</target>
...
</project>
You can see the full script in context here.
On a Mac, right-clicking the application icon and selecting “Get Info” shows 1.0 instead of the correct version number as you can see in the following screenshot:
Similarly, on Linux the version number shows as 1.0 during the installation of the .deb
file:
Does anyone know how to fix Ant script so that the correct version appears?
I'm using Oracle JDK 1.8.0_66 on both the Mac and on LInux.
I've finally solved this. The problem it would seem, was caused by the fact that I had a <fx:application>
element with a refid
attribute referring to a separate <fx:application>
. The solution was to combine these two <fx:application>
elements into a single element, as follows:
<fx:application id="VocabHunterId"
name="VocabHunter"
mainClass="${mainClass}"
version="${version}"/>
I found that I had to include the id="VocabHunterId"
attribute for some reason: without it the file association did not work.
I've tested this out and it works nicely showing the version number correctly for the installed bundle on OS X 10.11.4 with Oracle JDK 1.8.0_77 and on Ubuntu 14.04 also with Oracle JDK 1.8.0_77. If you'd like to see the full script (including this fix) in context, you can find it here.