jruby / activerecord-jdbc-adapter

JRuby's ActiveRecord adapter using JDBC.
BSD 2-Clause "Simplified" License
462 stars 385 forks source link

Building issue for newest main branch #1159

Closed ryudoawaru closed 1 month ago

ryudoawaru commented 1 month ago

When I checkout the source from this repo and try to build jar:

➜ activerecord-jdbc-adapter git:(master) jruby -S rake jar

I encountered following error:

➜  activerecord-jdbc-adapter git:(master) jruby -S rake jar
/opt/homebrew/opt/openjdk@21/bin/javac -target 1.8 -source 1.8 -Xlint:unchecked -g -cp "/Users/ryudo/.rvm/rubies/jruby-9.4.8.0/lib/ojdbc11.jar:jdbc-postgres/lib/postgresql-42.7.1.jar:jdbc-mysql/lib/mysql-connector-java-8.0.30.jar" -d /var/folders/xs/_3hn7ntn6dz1n3q154fhf1y00000gq/T/d20241013-89621-vx0sps src/java/arjdbc/ArJdbcModule.java src/java/arjdbc/db2/DB2Module.java src/java/arjdbc/db2/DB2RubyJdbcConnection.java src/java/arjdbc/h2/H2Module.java src/java/arjdbc/h2/H2RubyJdbcConnection.java src/java/arjdbc/hsqldb/HSQLDBModule.java src/java/arjdbc/jdbc/AdapterJavaService.java src/java/arjdbc/jdbc/Callable.java src/java/arjdbc/jdbc/ConnectionFactory.java src/java/arjdbc/jdbc/DataSourceConnectionFactory.java src/java/arjdbc/jdbc/DriverConnectionFactory.java src/java/arjdbc/jdbc/DriverWrapper.java src/java/arjdbc/jdbc/JdbcResult.java src/java/arjdbc/jdbc/RubyConnectionFactory.java src/java/arjdbc/jdbc/RubyJdbcConnection.java src/java/arjdbc/mssql/MSSQLModule.java src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java src/java/arjdbc/mysql/MySQLModule.java src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java src/java/arjdbc/oracle/OracleModule.java src/java/arjdbc/oracle/OracleRubyJdbcConnection.java src/java/arjdbc/postgresql/ByteaUtils.java src/java/arjdbc/postgresql/PgDateTimeUtils.java src/java/arjdbc/postgresql/PostgreSQLModule.java src/java/arjdbc/postgresql/PostgreSQLResult.java src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java src/java/arjdbc/sqlite3/SQLite3Module.java src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java src/java/arjdbc/util/CallResultSet.java src/java/arjdbc/util/DateTimeUtils.java src/java/arjdbc/util/ObjectSupport.java src/java/arjdbc/util/PG.java src/java/arjdbc/util/QuotingUtils.java src/java/arjdbc/util/StringCache.java src/java/arjdbc/util/StringHelper.java
warning: [options] bootstrap class path not set in conjunction with -source 8
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
src/java/arjdbc/ArJdbcModule.java:32: error: package org.jruby does not exist
import org.jruby.Ruby;
                ^
src/java/arjdbc/ArJdbcModule.java:33: error: package org.jruby does not exist
import org.jruby.RubyArray;
                ^
src/java/arjdbc/ArJdbcModule.java:34: error: package org.jruby does not exist
import org.jruby.RubyClass;
                ^
src/java/arjdbc/ArJdbcModule.java:35: error: package org.jruby does not exist
import org.jruby.RubyModule;
                ^
src/java/arjdbc/ArJdbcModule.java:36: error: package org.jruby does not exist
import org.jruby.RubyString;
                ^
src/java/arjdbc/ArJdbcModule.java:37: error: package org.jruby.anno does not exist
import org.jruby.anno.JRubyMethod;
                     ^
src/java/arjdbc/ArJdbcModule.java:38: error: package org.jruby.exceptions does not exist
import org.jruby.exceptions.RaiseException;
                           ^
src/java/arjdbc/ArJdbcModule.java:39: error: package org.jruby.runtime does not exist
import org.jruby.runtime.Block;
                        ^
src/java/arjdbc/ArJdbcModule.java:40: error: package org.jruby.runtime does not exist
import org.jruby.runtime.ThreadContext;
                        ^
src/java/arjdbc/ArJdbcModule.java:41: error: package org.jruby.runtime.builtin does not exist
import org.jruby.runtime.builtin.IRubyObject;
                                ^
src/java/arjdbc/ArJdbcModule.java:42: error: package org.jruby.util does not exist
import org.jruby.util.ByteList;
                     ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:66: error: package org.joda.time does not exist
import org.joda.time.DateTime;
                    ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:67: error: package org.joda.time does not exist
import org.joda.time.DateTimeZone;
                    ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:68: error: package org.jruby does not exist
import org.jruby.Ruby;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:69: error: package org.jruby does not exist
import org.jruby.RubyArray;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:70: error: package org.jruby does not exist
import org.jruby.RubyBasicObject;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:71: error: package org.jruby does not exist
import org.jruby.RubyBignum;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:72: error: package org.jruby does not exist
import org.jruby.RubyBoolean;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:73: error: package org.jruby does not exist
import org.jruby.RubyClass;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:74: error: package org.jruby does not exist
import org.jruby.RubyException;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:75: error: package org.jruby does not exist
import org.jruby.RubyFixnum;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:76: error: package org.jruby does not exist
import org.jruby.RubyHash;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:77: error: package org.jruby does not exist
import org.jruby.RubyIO;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:78: error: package org.jruby does not exist
import org.jruby.RubyInteger;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:79: error: package org.jruby does not exist
import org.jruby.RubyModule;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:80: error: package org.jruby does not exist
import org.jruby.RubyNumeric;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:81: error: package org.jruby does not exist
import org.jruby.RubyObject;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:82: error: package org.jruby does not exist
import org.jruby.RubyString;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:83: error: package org.jruby does not exist
import org.jruby.RubySymbol;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:84: error: package org.jruby does not exist
import org.jruby.RubyTime;
                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:85: error: package org.jruby.anno does not exist
import org.jruby.anno.JRubyMethod;
                     ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:86: error: package org.jruby.exceptions does not exist
import org.jruby.exceptions.RaiseException;
                           ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:87: error: package org.jruby.ext.bigdecimal does not exist
import org.jruby.ext.bigdecimal.RubyBigDecimal;
                               ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:88: error: package org.jruby.ext.date does not exist
import org.jruby.ext.date.RubyDate;
                         ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:89: error: package org.jruby.ext.date does not exist
import org.jruby.ext.date.RubyDateTime;
                         ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:90: error: package org.jruby.javasupport does not exist
import org.jruby.javasupport.JavaEmbedUtils;
                            ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:91: error: package org.jruby.javasupport does not exist
import org.jruby.javasupport.JavaUtil;
                            ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:92: error: package org.jruby.runtime does not exist
import org.jruby.runtime.Block;
                        ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:93: error: package org.jruby.runtime does not exist
import org.jruby.runtime.ObjectAllocator;
                        ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:94: error: package org.jruby.runtime does not exist
import org.jruby.runtime.ThreadContext;
                        ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:95: error: package org.jruby.runtime does not exist
import org.jruby.runtime.Visibility;
                        ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:96: error: package org.jruby.runtime.builtin does not exist
import org.jruby.runtime.builtin.IRubyObject;
                                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:97: error: package org.jruby.runtime.builtin does not exist
import org.jruby.runtime.builtin.Variable;
                                ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:98: error: package org.jruby.runtime.callsite does not exist
import org.jruby.runtime.callsite.CachingCallSite;
                                 ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:99: error: package org.jruby.runtime.callsite does not exist
import org.jruby.runtime.callsite.FunctionalCachingCallSite;
                                 ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:100: error: package org.jruby.runtime.component does not exist
import org.jruby.runtime.component.VariableEntry;
                                  ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:101: error: package org.jruby.util does not exist
import org.jruby.util.ByteList;
                     ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:102: error: package org.jruby.util does not exist
import org.jruby.util.SafePropertyAccessor;
                     ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:103: error: package org.jruby.util does not exist
import org.jruby.util.TypeConverter;
                     ^
src/java/arjdbc/jdbc/DataSourceConnectionFactory.java:34: error: package org.jruby.runtime does not exist
import org.jruby.runtime.ThreadContext;
                        ^
src/java/arjdbc/jdbc/DataSourceConnectionFactory.java:35: error: package org.jruby.util does not exist
import org.jruby.util.SafePropertyAccessor;
                     ^
src/java/arjdbc/util/StringHelper.java:29: error: package org.jcodings does not exist
import org.jcodings.Encoding;
                   ^
src/java/arjdbc/util/StringHelper.java:30: error: package org.jruby does not exist
import org.jruby.Ruby;
                ^
src/java/arjdbc/util/StringHelper.java:31: error: package org.jruby does not exist
import org.jruby.RubyString;
                ^
src/java/arjdbc/util/StringHelper.java:32: error: package org.jruby.util does not exist
import org.jruby.util.ByteList;
                     ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:111: error: package org.jruby does not exist
import static org.jruby.RubyTime.getLocalTimeZone;
                       ^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:111: error: static import only from classes and interfaces
import static org.jruby.RubyTime.getLocalTimeZone;
^
src/java/arjdbc/jdbc/RubyJdbcConnection.java:117: error: cannot find symbol
public class RubyJdbcConnection extends RubyObject {
                                        ^
  symbol: class RubyObject
src/java/arjdbc/ArJdbcModule.java:54: error: cannot find symbol
    public static RubyModule load(final Ruby runtime) {
                                        ^
  symbol:   class Ruby
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:54: error: cannot find symbol
    public static RubyModule load(final Ruby runtime) {
                  ^
  symbol:   class RubyModule
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:60: error: cannot find symbol
    public static RubyModule get(final Ruby runtime) {
                                       ^
  symbol:   class Ruby
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:60: error: cannot find symbol
    public static RubyModule get(final Ruby runtime) {
                  ^
  symbol:   class RubyModule
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:64: error: cannot find symbol
    public static void warn(final ThreadContext context, final String message) {
                                  ^
  symbol:   class ThreadContext
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:80: error: cannot find symbol
    public static IRubyObject load_java_part(final ThreadContext context,
                                                   ^
  symbol:   class ThreadContext
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:81: error: cannot find symbol
        final IRubyObject self, final IRubyObject[] args) {
              ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:81: error: cannot find symbol
        final IRubyObject self, final IRubyObject[] args) {
                                      ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:80: error: cannot find symbol
    public static IRubyObject load_java_part(final ThreadContext context,
                  ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:164: error: cannot find symbol
    public static IRubyObject modules(final ThreadContext context, final IRubyObject self) {
                                            ^
  symbol:   class ThreadContext
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:164: error: cannot find symbol
    public static IRubyObject modules(final ThreadContext context, final IRubyObject self) {
                                                                         ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:164: error: cannot find symbol
    public static IRubyObject modules(final ThreadContext context, final IRubyObject self) {
                  ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:187: error: cannot find symbol
    public static IRubyObject load_driver(final ThreadContext context, final IRubyObject self,
                                                ^
  symbol:   class ThreadContext
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:187: error: cannot find symbol
    public static IRubyObject load_driver(final ThreadContext context, final IRubyObject self,
                                                                             ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:188: error: cannot find symbol
        final IRubyObject const_name) { // e.g. load_driver(:MySQL)
              ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:187: error: cannot find symbol
    public static IRubyObject load_driver(final ThreadContext context, final IRubyObject self,
                  ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:194: error: cannot find symbol
    static final Map<Ruby, Map<String, Boolean>> loadedDrivers = new WeakHashMap<>(8);
                     ^
  symbol:   class Ruby
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:196: error: cannot find symbol
    private static IRubyObject loadDriver(final ThreadContext context, final IRubyObject self,
                                                ^
  symbol:   class ThreadContext
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:196: error: cannot find symbol
    private static IRubyObject loadDriver(final ThreadContext context, final IRubyObject self,
                                                                             ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:196: error: cannot find symbol
    private static IRubyObject loadDriver(final ThreadContext context, final IRubyObject self,
                   ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:253: error: cannot find symbol
    private static Object invokeStatic(final Ruby runtime,
                                             ^
  symbol:   class Ruby
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:264: error: cannot find symbol
    private static RaiseException newNativeException(final Ruby runtime, final Throwable cause) {
                                                           ^
  symbol:   class Ruby
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:264: error: cannot find symbol
    private static RaiseException newNativeException(final Ruby runtime, final Throwable cause) {
                   ^
  symbol:   class RaiseException
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:271: error: cannot find symbol
    public static IRubyObject with_meta_data_from_data_source_if_any(final ThreadContext context,
                                                                           ^
  symbol:   class ThreadContext
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:272: error: cannot find symbol
        final IRubyObject self, final IRubyObject config, final Block block) {
              ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:272: error: cannot find symbol
        final IRubyObject self, final IRubyObject config, final Block block) {
                                      ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:272: error: cannot find symbol
        final IRubyObject self, final IRubyObject config, final Block block) {
                                                                ^
  symbol:   class Block
  location: class ArJdbcModule
src/java/arjdbc/ArJdbcModule.java:271: error: cannot find symbol
    public static IRubyObject with_meta_data_from_data_source_if_any(final ThreadContext context,
                  ^
  symbol:   class IRubyObject
  location: class ArJdbcModule
src/java/arjdbc/jdbc/RubyJdbcConnection.java:125: error: cannot find symbol
    private IRubyObject config;
            ^
  symbol:   class IRubyObject
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:126: error: cannot find symbol
    private IRubyObject adapter; // the AbstractAdapter instance we belong to
            ^
  symbol:   class IRubyObject
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:128: error: cannot find symbol
    private RubyClass attributeClass;
            ^
  symbol:   class RubyClass
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:135: error: cannot find symbol
    protected RubyJdbcConnection(Ruby runtime, RubyClass metaClass) {
                                 ^
  symbol:   class Ruby
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:135: error: cannot find symbol
    protected RubyJdbcConnection(Ruby runtime, RubyClass metaClass) {
                                               ^
  symbol:   class RubyClass
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:140: error: cannot find symbol
    private static final ObjectAllocator ALLOCATOR = new ObjectAllocator() {
                         ^
  symbol:   class ObjectAllocator
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:146: error: cannot find symbol
    public static RubyClass createJdbcConnectionClass(final Ruby runtime) {
                                                            ^
  symbol:   class Ruby
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:146: error: cannot find symbol
    public static RubyClass createJdbcConnectionClass(final Ruby runtime) {
                  ^
  symbol:   class RubyClass
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:153: error: cannot find symbol
    public static RubyClass getJdbcConnection(final Ruby runtime) {
                                                    ^
  symbol:   class Ruby
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:153: error: cannot find symbol
    public static RubyClass getJdbcConnection(final Ruby runtime) {
                  ^
  symbol:   class RubyClass
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:157: error: cannot find symbol
    protected static RubyModule ActiveRecord(ThreadContext context) {
                                             ^
  symbol:   class ThreadContext
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:157: error: cannot find symbol
    protected static RubyModule ActiveRecord(ThreadContext context) {
                     ^
  symbol:   class RubyModule
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:161: error: cannot find symbol
    public static RubyClass getBase(final Ruby runtime) {
                                          ^
  symbol:   class Ruby
  location: class RubyJdbcConnection
src/java/arjdbc/jdbc/RubyJdbcConnection.java:161: error: cannot find symbol
    public static RubyClass getBase(final Ruby runtime) {
                  ^
  symbol:   class RubyClass
  location: class RubyJdbcConnection
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
100 errors
4 warnings
only showing the first 100 errors, of 2182 total; use -Xmaxerrs if you would like to see more
rake aborted!
could not build .jar extension - compilation failure
/Users/ryudo/ghq/github.com/jruby/activerecord-jdbc-adapter/Rakefile:318:in `block in <main>'
/Users/ryudo/ghq/github.com/jruby/activerecord-jdbc-adapter/Rakefile:317:in `block in <main>'
/Users/ryudo/ghq/github.com/jruby/activerecord-jdbc-adapter/Rakefile:300:in `block in <main>'
org/jruby/ext/monitor/Monitor.java:82:in `synchronize'
org/jruby/ext/monitor/Monitor.java:82:in `synchronize'
/Users/ryudo/.rvm/gems/jruby-9.4.8.0/gems/rake-13.2.1/exe/rake:27:in `<main>'
Tasks: TOP => jar => lib/arjdbc/jdbc/adapter_java.jar
(See full trace by running task with --trace)

I also can install this gem by neither adding the source into Gemfile not gem speicfic install.

headius commented 1 month ago

This is caused by the build being unable to find JRuby itself. Perhaps this should be smarter when building with JRuby and use the jar file in the current JRuby installation, but I believe the build looks for JRuby under a relative dir like ../jruby. I'll try to sort that out and add something to docs.

headius commented 1 month ago

It's this section here trying to sort out the JRuby jar file, I believe:

https://github.com/jruby/activerecord-jdbc-adapter/blob/893c9d2edb0fe03dc50d66adc1e8c2ba1eb4d30c/Rakefile#L264-L275

It first looks in java.class.path for the JRuby jar, which for me does not appear to contain anything:

$ jruby -e 'puts ENV_JAVA["java.class.path"]'                                     
:

Then it tries to use RbConfig to find the location of the lib dir, where the JRuby jar file should be. The same logic for me does find the JRuby jar:

$ jruby -rrbconfig -e 'p File.exist?(RbConfig::CONFIG["libdir"] + "/jruby.jar")'
true

@ryudoawaru Could you try these snippits of code on your rvm JRuby installation and see if they find the jruby.jar file?

ryudoawaru commented 1 month ago

In my local machine(rvm + jruby 9480)

➜  ~ ruby -e 'puts ENV_JAVA["java.class.path"]'
/Users/ryudo/.rvm/rubies/jruby-9.4.8.0/lib/ojdbc11.jar:
➜  ~ jruby -rrbconfig -e 'p File.exist?(RbConfig::CONFIG["libdir"] + "/jruby.jar")'
true
true
➜  ~ ls /Users/ryudo/.rvm/rubies/jruby-9.4.8.0/lib/
jni         jruby.jar   ojdbc11.jar ruby

➜  ~ whereis javac
javac: /usr/bin/javac /opt/homebrew/opt/openjdk@21/share/man/man1/javac.1

However I found I can finish building gem in 9.4.8.0-jdk21 docker image.