[External] : Re: jpackage Windows support for 4 digits version

Alexey Semenyuk alexey.semenyuk at oracle.com
Fri Mar 25 18:57:24 UTC 2022


Sverre,

exe installers generated by jpackage are just wrappers for msi installers.

Moving workaround you have in Gradle into jpackage will not solve the 
problem, but will hide it. This doesn't look appealing.
We need a better solution. I created 
https://bugs.openjdk.java.net/browse/JDK-8283707 CR to track your request.

- Alexey

On 3/25/2022 3:21 AM, Sverre Moe wrote:
> Hi,
>
> I was hoping something could be done to allow 4 fields in the version 
> on Windows when using jpackage.
> Even though Windows will ignore the fourth component when installing, 
> that is ok, but if we could build just build an EXE with 4 fields 
> version. If by some configuration with jpackage, or the WiX Toolset it 
> uses to build an EXE.
>
> I wanted to avoid having to configure an exception for Windows in 
> Gradle like this
>     jpackage {
>         if (isWindows) {
>             appVersion = applicationVersion.substring(0, 
> applicationVersion.lastIndexOf("."))
>         } else {
>             appVersion = applicationVersion
>         }
>     }
>
> I found someone who made a solution to allow a version with 4 fields 
> on Windows.
> https://github.com/hvandrie/msiCAFindRelatedProductsEx
> However that would be a much more complex workaround than the one above.
>
>
>
> /Sverre
>
>
> fre. 25. mar. 2022 kl. 08:00 skrev David Holmes <david.holmes at oracle.com>:
>
>     On 25/03/2022 5:14 am, Alexey Semenyuk wrote:
>     > Hi Sverre,
>     >
>     > Oh, I misunderstood the problem. I though the issue was with
>     parsing WiX
>     > version string, but the problem is that jpackage doesn't like
>     the value
>     > of --version cli parameter.
>     > On windows this value should satisfy constrains of MSI
>     ProductVersion
>     > property [1]:
>     > The format of the string is as follows:
>     > major.minor.build
>     > The first field is the major version and has a maximum value of
>     255. The
>     > second field is the minor version and has a maximum value of
>     255. The
>     > third field is called the build version or the update version
>     and has a
>     > maximum value of 65,535.
>
>     It also states:
>
>     "Note that Windows Installer uses only the first three fields of the
>     product version. If you include a fourth field in your product
>     version,
>     the installer ignores the fourth field."
>
>     So I think ignoring that fourth field is what is being requested.
>
>     Cheers,
>     David
>
>     > If not doing validation early, wix candle will fail later. This is
>     > platform limitation, not the limitation of jpackage.
>     >
>     > [1]
>     https://msdn.microsoft.com/en-us/library/aa370859%28v=VS.85%29.aspx
>     >
>     > - Alexey
>     >
>     > On 3/24/2022 2:04 PM, Sverre Moe wrote:
>     >> Hi,
>     >>
>     >> This has been attempted on Java 15, Java 16 and the latest Java 17.
>     >>
>     >> This is the output from Java 17
>     >>
>     >> 14:46:49
>     >>
>      C:\cygwin64\home\build\jenkins-test\workspace\our-awesome-project_sverre_SF-99>gradlew.bat
>
>     >>    --no-daemon --version
>     >> 14:46:51
>     >> 14:46:51
>      ------------------------------------------------------------
>     >> 14:46:51  Gradle 7.3.3
>     >> 14:46:51
>      ------------------------------------------------------------
>     >> 14:46:51
>     >> 14:46:51  Build time:   2021-12-22 12:37:54 UTC
>     >> 14:46:51  Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
>     >> 14:46:51
>     >> 14:46:51  Kotlin:       1.5.31
>     >> 14:46:51  Groovy:       3.0.9
>     >> 14:46:51  Ant:          Apache Ant(TM) version 1.10.11 compiled on
>     >> July 10 2021
>     >> 14:46:51  JVM:          17.0.2 (Eclipse Adoptium 17.0.2+8)
>     >> 14:46:51  OS:           Windows 10 10.0 amd64
>     >>
>     >>
>     >> 14:46:53
>     >>
>      C:\cygwin64\home\build\jenkins-test\workspace\our-awesome-project_sverre_SF-99>gradlew.bat
>
>     >>    --no-daemon --stacktrace --refresh-dependencies -Pheadless
>     >> createPackage
>     >> 14:48:51  > Task :jpackage
>     >> 14:48:51  [14:49:12.348] Running candle.exe
>     >> 14:48:51  [14:49:12.386] Running C:\Program Files (x86)\WiX
>     Toolset
>     >> v3.11\bin\candle.exe
>     >> 14:48:51  [14:49:12.762] Running light.exe
>     >> 14:48:51  [14:49:12.773] Running C:\Program Files (x86)\WiX
>     Toolset
>     >> v3.11\bin\light.exe
>     >> 14:48:51  [14:49:13.207] Detected [candle.exe] version
>     [3.11.2.4516].
>     >> 14:48:51  [14:49:13.208] Detected [light.exe] version
>     [3.11.2.4516].
>     >> 14:48:51  [14:49:13.210] WiX 3.11.2.4516 detected. Enabling
>     advanced
>     >> cleanup action.
>     >> 14:48:51  [14:49:13.211] jdk.jpackage.internal.ConfigException:
>     >> Version sting may have between 1 and 3 components: 1, 1.2, 1.2.3.
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.validate(WinMsiBundler.java:319)
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.WinExeBundler.validate(WinExeBundler.java:93)
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:675)
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
>
>     >>
>     >> 14:48:51   at
>     jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
>     >> 14:48:51   at
>     jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
>     >> 14:48:51  Caused by: java.lang.IllegalArgumentException:
>     Version sting
>     >> may have between 1 and 3 components: 1, 1.2, 1.2.3.
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.MsiVersion.of(MsiVersion.java:46)
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.validate(WinMsiBundler.java:317)
>
>     >>
>     >> 14:48:51   ... 5 more
>     >> 14:48:51  [14:49:13.218] jdk.jpackage.internal.PackagerException:
>     >> Bundler EXE Installer Package skipped because of a configuration
>     >> problem: Version sting may have between 1 and 3 components: 1,
>     1.2,
>     >> 1.2.3.
>     >> 14:48:51  Advice to fix: Set value of --app-version parameter
>     >> according to these rules:
>     >>
>     https://msdn.microsoft.com/en-us/library/aa370859%28v=VS.85%29.aspx
>     >>
>     <https://urldefense.com/v3/__https://msdn.microsoft.com/en-us/library/aa370859*28v=VS.85*29.aspx__;JSU!!ACWV5N9M2RV99hQ!YstqoaSBaYrCTH11faRgBaN3Ty0NnlGP-1Q-IPI8DaDXTXeHNu1-VkCoS5UeOYqO3iFS$>
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:688)
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
>
>     >>
>     >> 14:48:51   at
>     jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
>     >> 14:48:51   at
>     jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
>     >> 14:48:51  Caused by: jdk.jpackage.internal.ConfigException:
>     Version
>     >> sting may have between 1 and 3 components: 1, 1.2, 1.2.3.
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.validate(WinMsiBundler.java:319)
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.WinExeBundler.validate(WinExeBundler.java:93)
>
>     >>
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:675)
>
>     >>
>     >> 14:48:51   ... 3 more
>     >> 14:48:51  Caused by: java.lang.IllegalArgumentException:
>     Version sting
>     >> may have between 1 and 3 components: 1, 1.2, 1.2.3.
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.MsiVersion.of(MsiVersion.java:46)
>     >> 14:48:51   at
>     >>
>     jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.validate(WinMsiBundler.java:317)
>
>     >>
>     >> 14:48:51   ... 5 more
>     >> 14:48:51
>     >> 14:48:51
>     >> 14:48:51  > Task :jpackage FAILED
>     >> 14:48:51
>     >> 14:48:51  FAILURE: Build failed with an exception.
>     >> 14:48:51
>     >> 14:48:51  * What went wrong:
>     >> 14:48:51  Execution failed for task ':jpackage'.
>     >> 14:48:51  > Process 'command 'C:\Program Files\Eclipse
>     >> Adoptium\jdk-17.0.2.8-hotspot/bin/jpackage.exe'' finished with
>     >> non-zero exit
>     >>
>     >>
>     >>
>     >> tor. 24. mar. 2022 kl. 17:39 skrev Alexey Semenyuk
>     >> <alexey.semenyuk at oracle.com>:
>     >>
>     >>     Hi Sverre,
>     >>
>     >>     The output comes from quite old jpackage (jdk15, I guess).
>     Please try
>     >>     jpackage from the newer jdk (the latest one would be the best
>     >>     option).
>     >>     They don't have this issue.
>     >>
>     >>     - Alexey
>     >>
>     >>     On 3/23/2022 10:01 AM, Sverre Moe wrote:
>     >>     > Could jpackage instruct WiX when building a native
>     application
>     >>     on Windows,
>     >>     > to support 4 digits in the version?
>     >>     >
>     >>     > 14:41:18  Detected [light.exe] version [3.11.2.4516].
>     >>     > 14:41:18  Detected [candle.exe] version [3.11.2.4516].
>     >>     > 14:41:18  WiX 3.11.2.4516 detected. Enabling advanced cleanup
>     >>     action.
>     >>     > 14:41:18  Version sting may have up to 3 components -
>     >>     major.minor.build .
>     >>     > 14:41:18 jdk.incubator.jpackage.internal.ConfigException:
>     >>     Version string
>     >>     > is not compatible with MSI rules [1.10.3.1]
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinMsiBundler.validate(WinMsiBundler.java:256)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinExeBundler.validate(WinExeBundler.java:99)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.generateBundle(Arguments.java:640)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.processArguments(Arguments.java:514)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.main.Main.execute(Main.java:97)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.main.Main.main(Main.java:51)
>
>     >>
>     >>     > 14:41:18 jdk.incubator.jpackage.internal.PackagerException:
>     >>     Bundler EXE
>     >>     > Installer Package skipped because of a configuration problem:
>     >>     Version
>     >>     > string is not compatible with MSI rules [1.10.3.1]
>     >>     > 14:41:18  Advice to fix: Set the bundler argument
>     >>     "win.msi.productVersion"
>     >>     > according to these rules:
>     >>     >
>     >> https://msdn.microsoft.com/en-us/library/aa370859%28v=VS.85%29.aspx
>     >>
>     >>
>     <https://urldefense.com/v3/__https://msdn.microsoft.com/en-us/library/aa370859*28v=VS.85*29.aspx__;JSU!!ACWV5N9M2RV99hQ!YstqoaSBaYrCTH11faRgBaN3Ty0NnlGP-1Q-IPI8DaDXTXeHNu1-VkCoS5UeOYqO3iFS$>
>
>     >>
>     >>     .
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.generateBundle(Arguments.java:653)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.processArguments(Arguments.java:514)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.main.Main.execute(Main.java:97)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.main.Main.main(Main.java:51)
>
>     >>
>     >>     > 14:41:18  Caused by:
>     >>     jdk.incubator.jpackage.internal.ConfigException:
>     >>     > Version string is not compatible with MSI rules [1.10.3.1]
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinMsiBundler.validate(WinMsiBundler.java:256)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinExeBundler.validate(WinExeBundler.java:99)
>
>     >>
>     >>     > 14:41:18   at
>     >>     >
>     >>
>     >>
>     jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.generateBundle(Arguments.java:640)
>
>     >>
>     >>     > 14:41:18   ... 3 more
>     >>     >
>     >>     > Perhaps something like this solution could be
>     incorporated with the
>     >>     > JPackage tool.
>     >>     > https://github.com/hvandrie/msiCAFindRelatedProductsEx
>     >>
>     >>
>     <https://urldefense.com/v3/__https://github.com/hvandrie/msiCAFindRelatedProductsEx__;!!ACWV5N9M2RV99hQ!YstqoaSBaYrCTH11faRgBaN3Ty0NnlGP-1Q-IPI8DaDXTXeHNu1-VkCoS5UeOR0PTqUZ$>
>
>     >>
>     >>     > jpackage --windows-version-components=4
>     >>
>


More information about the core-libs-dev mailing list