gnodet commented on code in PR #24664: URL: https://github.com/apache/camel/pull/24664#discussion_r3571899987
########## docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc: ########## @@ -56,6 +56,28 @@ run the CLI automatically renames a pre-existing global `~/.camel-jbang-user.pro `~/.camel-cli.properties` and a pre-existing local `./camel-jbang-user.properties` to `./camel-cli.properties`; an existing new file is never overwritten. +==== Camel CLI launcher Java runtime discovery + +The self-contained Camel CLI launcher scripts (`bin/camel.sh` and `bin/camel.bat` in the +`camel-launcher` distribution) now share a single Java runtime discovery contract. Candidates +are evaluated in this fixed order, and the first one that exists, is executable, and reports a +Java major version of at least 17 is used: + +1. `JAVACMD` (explicit override, unchanged). +2. `$JAVA_HOME/bin/java` (`%JAVA_HOME%\bin\java.exe` on Windows). This is also how the SDKMAN + `java` candidate is honored, since SDKMAN exports `JAVA_HOME`. +3. The first `java` (`java.exe`) found on `PATH`. +4. `CAMEL_FALLBACK_JAVA`, a new variable set by package-manager installs when the JDK location + is deterministic. + +Candidates older than Java 17, missing, non-executable, or with unparseable version output are +skipped. If none qualify, the launcher now exits nonzero with a diagnostic listing the checked +sources instead of attempting to run an unsuitable Java. + +The obsolete macOS `JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/...` default was +removed from `camel.sh`; set `JAVA_HOME` or `JAVACMD`, or ensure a Java 17+ `java` is on `PATH`. Review Comment: Consider adding a note about the other two removed platform-specific behaviors that are not mentioned here: - **Gentoo Linux**: The `java-config --jre-home` auto-detection (triggered by `/etc/gentoo-release`) was removed. Gentoo users should set `JAVA_HOME` explicitly. - **IBM AIX**: The `$JAVA_HOME/jre/sh/java` probe (IBM's non-standard JDK path) was removed. AIX users should set `JAVACMD` to point at their Java binary. Both are very low-impact, but mentioning them makes the upgrade guide exhaustive for the rare users who might rely on these. _Claude Code review on behalf of @gnodet_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
