Skip to content

rcljava_common build error: source option 6 is no longer supported. Use 8 or later. #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Hyrtsi opened this issue Oct 15, 2024 · 1 comment

Comments

@Hyrtsi
Copy link

Hyrtsi commented Oct 15, 2024

Building on desktop. Ubuntu 22.04, ROS2 Humble.

Starting >>> rcljava_common
Finished <<< ament_cmake_export_jni_libraries [0.27s]
--- stderr: rcljava_common                              
warning: [options] bootstrap class path not set in conjunction with -source 6
error: Source option 6 is no longer supported. Use 8 or later.
error: Target option 6 is no longer supported. Use 8 or later.
gmake[2]: *** [CMakeFiles/rcljava_common_jar.dir/build.make:92: CMakeFiles/rcljava_common_jar.dir/java_compiled_rcljava_common_jar] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:154: CMakeFiles/rcljava_common_jar.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< rcljava_common [1.32s, exited with code 2]

Summary: 4 packages finished [2.50s]
  1 package failed: rcljava_common
@ChristophSchwanke
Copy link

I guess I managed to solve this (using Java 21):

diff --git a/rcljava_common/CMakeLists.txt b/rcljava_common/CMakeLists.txt
index 3bc04fd..e351257 100644
--- a/rcljava_common/CMakeLists.txt
+++ b/rcljava_common/CMakeLists.txt
@@ -30,7 +30,7 @@ if(NOT WIN32)
   add_compile_options(-Wall -Wextra -Wpedantic)
 endif()
 
-set(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.6" "-target" "1.6")
+set(CMAKE_JAVA_COMPILE_FLAGS "-source" "21" "-target" "21")

Check your java version like this: java --version
It looks like this for me:
openjdk 21.0.5 2024-10-15
OpenJDK Runtime Environment (build 21.0.5+11-Ubuntu-1ubuntu124.04)
OpenJDK 64-Bit Server VM (build 21.0.5+11-Ubuntu-1ubuntu124.04, mixed mode, sharing)

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

No branches or pull requests

2 participants