Skip to content

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

Open

Description

@Hyrtsi

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

Activity

  1. ChristophSchwanke commented on Jan 22, 2025

    @ChristophSchwanke

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions