davsclaus opened a new pull request, #29465:
URL: https://github.com/apache/camel/pull/29465

   ## What
   
   Running the Camel CLI from the launcher distribution on Java 24+ (here Java 
27) prints this on `camel tui`:
   
   ```
   WARNING: A restricted method in java.lang.foreign.MemorySegment has been 
called
   WARNING: java.lang.foreign.MemorySegment::reinterpret has been called by 
org.jline.terminal.impl.ffm.FfmTerminalProvider in an unnamed module 
(file:.../lib/jline-4.4.8.jar)
   WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for 
callers in this module
   WARNING: Restricted methods will be blocked in a future release unless 
native access is enabled
   ```
   
   JLine drives the terminal through the FFM API, which needs native access 
since JEP 472. The JBang launcher already passes 
`--enable-native-access=ALL-UNNAMED` (70ae21b6f516); the launcher distribution 
did not.
   
   ## Fix
   
   `Enable-Native-Access: ALL-UNNAMED` in the manifest of both launcher JARs 
(the JVM honours it for `java -jar`):
   
   - the thin launcher JAR in `lib/` (assembly `launcher-jar`): started with 
`-jar` by `bin/camel.sh` (also Homebrew), `camel.bat` and so `camel.exe`
   - the self-executing JAR (`maven-jar-plugin` manifest, which the repackager 
keeps): started with `-jar` by the container's `run.sh`
   
   Being in the manifest, it applies whatever `JAVA_OPTS` is set to, and the 
scripts stay unchanged. Java 21 ignores the unknown attribute.
   
   ## Testing
   
   On Java 27.0.1, with the built `-bin.zip`:
   
   - `bin/camel.sh tui` and `java -jar camel-launcher-4.24.0-SNAPSHOT.jar tui` 
start the TUI without the warning
   - control: `java -cp 'lib/*' ...CamelLauncher tui` (no manifest) still 
prints the warning above
   
   Not tested on Java 21 (not installed locally).
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to