From 37c4b2dbdad1b49c452d501088a9c4cf7a21240b Mon Sep 17 00:00:00 2001 From: Stephen Lane-Walsh Date: Tue, 11 Aug 2026 14:21:04 -0400 Subject: [PATCH] Build: Fix tests on Java >= 24 Add new command line option for running tests with Java >= 24 that allows system functions in native modules --- java/tests/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java/tests/CMakeLists.txt b/java/tests/CMakeLists.txt index a7feac990c..a7f906c7c8 100644 --- a/java/tests/CMakeLists.txt +++ b/java/tests/CMakeLists.txt @@ -32,6 +32,13 @@ if(ENABLE_JAVA AND NOT TEST_WITH_WINE AND NOT ENABLE_SANITIZE) -Djava.library.path=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ) + if(Java_VERSION VERSION_GREATER_EQUAL 24) + # Starting with Java 24, Java restricts all native code by default, including loadLibrary + list(APPEND JAVA_TEST_ARGUMENTS + --enable-native-access=ALL-UNNAMED + ) + endif() + if(ENABLE_VALGRIND) # Disable Java runtime optimizations / Just-In-Time (JIT) compilation