RFR: JDK-8258755: jpackage: Invalid 32-bit exe when building app-image
herrick at openjdk.java.net
Wed Jan 13 16:51:19 UTC 2021
On Wed, 13 Jan 2021 01:37:40 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
>> src/jdk.jpackage/share/classes/jdk/jpackage/internal/Platform.java line 127:
>>> 125: return is64b;
>>> 126: }
>> This is Windows specific thing. There is no point to keep it in shared code. I'd suggest to move this function in WixSourcesBuilder class.
>> I think it is not correct to check for arch of the OS where jpackage runs. Jpackage from 32bit JDK (if somebody would build 32bit OpenJDK) would bake in 32bit Java runtime in app image regardless Windows is 64bit or 32bit. So the arch of installer is determined by arch of Java runtime baked in the app image. For simplicity we can assume that arch of Java runtime is the same as the arch of jpackage (this might not be the case for external Java runtime case though, but let's leave this possibility aside as it is not supported anyways). If so, checking of `sun.arch.data.model` system property would be better alternative to `os.arch`.
> Sorry, I left this comment earlier, but it was lost.
I agree is better to have the check in windows specific code (not Platform) and will move it.
The "os.arch" System property in 32 java is "x86" regardless of whether running on 64 or 32 bit version of Windows, It reflects the arch of the running JVM (not the arch of the os as the name implies), so checking if system property "os.arch" is "x86" is the same as checking if "sun,arch.data.model" is "32". Since "os.arch" is the more documented property I think we should continue to use that.
More information about the core-libs-dev