Distinguish between JDK 32/64 bit with JVM Toolchains

I am working on a project that needs three various Javas:

  • JDK 8 64 bit for general purpose (buildSrc compile…)
  • JDK 8 32 bit to start a quite old tool
  • JDK 11 for Java compile (compatibility version 8)

We start the tasks with the fork option and set the executables to use (currently on Gradle 6.2).
I am wondering if there is a chance to do it also with JVM Toolchains.
A first sight there is no way to make Gradle aware of “I need a 32 bit Java”.
It’s only the Java version without any further precision of the architecture as far as I can see.

3 Likes

Is it already possible to define the platform (32-bit/64-bit) for the toolchain in addition to the Java version (e.g. 8, 17 or 21)?
Or will this feature no longer be available because only 64-bit JVMs will be supported from Java 21 onwards anyway?

We have solved it by manually setting the executable for the unit test and then executing the unit tests with 32-bit and 64-bit respectively. This is necessary in our case because our component/project is used in both 32-bit and 64-bit products and this component accesses DLLs where there is a version for 32-bit and 64-bit.

Perhaps others have faced the same problems and can describe their solution.

I don’t think I’ve yet seen a way to select architecture. And I also don’t find a feature request through a quick search. So you probably should open one after searching again too.

1 Like

It’s quite a time since…
Thank you, I will eventually do it.

1 Like