Search code examples
javajavafxjavafx-11jpackagejava-17

Can I make an installable 32-bit version of my app using jpackage (Java 17)


I've made an application using Java 17 with JavaFX 16 library. Is there a way to make an installable 32-bit version using JPackage of it? Since Java comes always just in 64-bit since Java 9 (same with JavaFX library), I doubt it's not possible, but is there any way to do it?


Solution

  • Yes, you can make an installable 32-bit version of a JavaFX app using jpackage (Java 17).

    Azul Zulu provide 32 bit JDK+JavaFX 17 downloads for various platforms. Switch your app to use that and package it using that JDK. When doing so, (I think) it won't be necessary to supply JavaFX Maven dependencies as the JavaFX modules will already be available from the Azul JDK+JavaFX platform distribution.

    I won't supply the full steps on how to use jpackage here, as that is documented and discussed elsewhere.

    From comments by the original poster, this method worked:

    Azul JDK worked perfectly in windows (I'm using windows, and my client (who has 32 bit OS) also uses windows)

    OR

    JavaFX packages in Maven central are available for various OS and 32-bit or 64-bit platform architectures.

    You can select from a specific architecture (or combination of architectures) as a dependency in Maven using a classifier, similar to this example (without the shading).

    If you go that route, you need to make sure that you choose the appropriate underlying JDK correctly when doing the packaging (choose a 32-bit JDK build rather than a 64-bit JDK build). Again, Azure Zulu (and possibly other JDK vendors) provide 32-bit JDK builds that you can use.

    If a Mac is your target device, Mac OS X does not support 32-bit apps, hence there are no 32 bit Java/JavaFX builds for Mac, only 64 bit builds targeting either Intel chips or the new Apple M1 chips.

    Examples of supported architectures for which there are binary JavaFX builds. This is based just on a quick look at the classifier extensions available for binary jars in the JavaFX Maven repository. The comments are just my guesses on what these are, not official documentation:

    • linux-aarch64 (linux arm v8 64 bit).
    • linux-arm32 (linux arm v7 32 bit).
    • linux (linux intel 64 bit).
    • mac-aarch64 (mac M1 64 bit).
    • mac (mac intel 64 bit).
    • win-x86 (win intel 32 bit).
    • win (win intel 64 bit).

    If no classifier is provided, I think the build will examine your current operating environment and choose the best fit.

    In addition for some platforms, there are builds with the -monocle suffix in the classifier, also available in 32 bit and 64 bit flavors for various OS types. This is targeted to embedded devices, or headless (no display, e.g. a server) and provides a version of JavaFX that does not use an OS-provided windowing system (i.e. windows are managed purely by JavaFX, not an X-windows window manager and not the Windows OS window manager) and may use Software rendering rather than Hardware rendering. Most people won't need this, but if interested see the (minimal) Monocle documentation.

    Gluon provides JavaFX support for various mobile architectures via Gluon Mobile. I believe it is different from a jpackage solution and instead relies on native compilation using GraalVM (but I could be wrong, I haven't investigated it). Regardless of how it works, if you need to target a mobile device for a JavaFX deployment, I advise that you check with Gluon and their mobile development, packaging and deployment solutions.