Skip to content

Tentative move to Java 25#2004

Merged
petebankhead merged 6 commits intoqupath:mainfrom
petebankhead:jdk-25
Oct 13, 2025
Merged

Tentative move to Java 25#2004
petebankhead merged 6 commits intoqupath:mainfrom
petebankhead:jdk-25

Conversation

@petebankhead
Copy link
Member

@petebankhead petebankhead commented Sep 30, 2025

This 'works', but is likely to require 1 big change and 2 small ones.

The big change is that removing --bind-services is almost certainly stripping back the JRE too much, and we'll need to add in more modules or switch to a JDK other than Temurin so that --bind-services can be reinstated.

The small changes:

  • Use Kotlin 2.3 when available
  • Use 2.0.0 for org.beryx.runtime when available Done

The license plugin should also be updated whenever possible, since it currently means we can only use jpackage if the build isn't parallelized.

This 'works', but is likely to require 1 big change and 2 small ones.

The big change is that removing '--bind-services' is probably stripping back the JRE too much, and we'll need to add in more modules or switch to a JDK other than Temurin so that we --bind-services can be reinstated.

The small changes:
- Use Kotlin 2.3 when available
- Use 2.0.0 for org.beryx.runtime when available

The license plugin should also be updated whenever possible, since it currently means we can only use jpackage if the build isn't parallelized.
@petebankhead petebankhead added this to the v0.7.0 milestone Sep 30, 2025
@petebankhead
Copy link
Member Author

petebankhead commented Oct 1, 2025

Reminder: The content under the 'Annotations' tab rescales badly with this PR (presumably due to a JavaFX change).
Edit: Fixed in next commit.

This was introduced in JavaFX 25, possibly with other `Region`-related changes that introduced a few regressions (or possibly because our original approach was flawed).
Mostly use `java.se`.
Add gradle support for `-Pbind-services` to build a runtime more like in previous QuPath releases, although it requires `jmods` to work.
@petebankhead
Copy link
Member Author

This should now work. It builds a smaller JRE than previous QuPath releases, but it seems to have everything required (this may prove wrong in the future, and we need to add modules).

The main difference is that we don't use --bind-services with jlink, because it doesn't work with Temurin.
If building with a JDK that does include jmods, we should be able to use

./gradlew package -Pbind-services

to get a result similar to how it was previously.

Note for developing extensions with include-extras

You might need to call Gradle with -Ptoolchain=25 to make includeBuild work with extensions.
This is because the extensions may be stubbornly trying to use Java 21, while the main QuPath code wants to use Java 25 - and they aren't compatible.

@petebankhead petebankhead marked this pull request as ready for review October 13, 2025 16:43
@alanocallaghan
Copy link
Contributor

Re: extensions, this would involve an update to our gradle plugin, or...?

@petebankhead
Copy link
Member Author

I don't think so, but you may prove me wrong.

The Java version is defined in the version catalog for a QuPath release.

The Gradle plugin should use that by default, unless overridden with -Ptoolchain=25 or similar.

The Gradle plugin itself is written to work with Java 11 so that it's not too fussy about how Gradle is launched (although Gradle 9 now requires Java 17).

@petebankhead petebankhead merged commit 84fd3d7 into qupath:main Oct 13, 2025
3 checks passed
@petebankhead petebankhead deleted the jdk-25 branch October 13, 2025 16:50
@alanocallaghan
Copy link
Contributor

alanocallaghan commented Oct 13, 2025

I ask because I ran into issues trying to run the ground truth extension recently: https://github.com/qupath/qupath-extension-ground-truth/pull/5

Helpfully I did not include the error message but it did relate to java versions

Error below:

Could not resolve all artifacts for configuration 'classpath'.
> Could not resolve io.github.qupath:qupath-gradle-plugin:0.1.0.
  Required by:
      settings file '../qupath-extension-ground-truth/settings.gradle.kts' > io.github.qupath.qupath-extension-settings:io.github.qupath.qupath-extension-settings.gradle.plugin:0.1.0
   > Dependency requires at least JVM runtime version 21. This build uses a Java 18 JVM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants