Installing latest jruby with ruby-install
Environment Information
Provide at least: I try to install the latest jruby using ruby-install,
uname -a
Linux toni6.6.34-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:00:06 UTC 2024 x86_64 GNU/Linux
But it point that I need jdk 8 installed, and that's not needed how can I change this:
java -version
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment (build 17.0.11+9)
OpenJDK 64-Bit Server VM (build 17.0.11+9, mixed mode, sharing)
and when I try to install I get this:
JAVA_HOME=/usr/lib/jvm/default ruby-install jruby-9.4.6.0 ✔
>>> Installing jruby 9.4.6.0 into /home/toni/.rubies/jruby-9.4.6.0 ...
>>> Installing dependencies for jruby 9.4.6.0 ...
[sudo] contrasenya per a toni:
Es resolen les dependències...
Se cerquen els paquets conflictius...
Paquets (2) jre8-openjdk-headless-8.412.u08-1 jre8-openjdk-8.412.u08-1
Mida total de la instal·lació: 97,78 MiB
:: N'inicio la instal·lació? [S/n] n
!!! Installing dependencies failed!
Other relevant info you may wish to add:
When I isntalled with teh required depdencies and using direnv it seems to work well:
ruby --version ✔ 4s ▼ jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 17.0.11+9 on 17.0.11+9 +jit [x86_64-linux]
bundle exec rspec spec --colour --format documentation ✔ ▼
An error occurred while loading ./spec/inputs/mongodb_spec.rb. Failure/Error: require "logstash/devutils/rspec/spec_helper"
LoadError: load error: jopenssl/load -- java.lang.NoClassDefFoundError: org/jruby/util/io/FileExistsException Did you mean? jopenssl/load
./.direnv/ruby/gems/jruby-openssl-0.9.19-java/lib/openssl.rb:1:in `'
./.direnv/ruby/gems/logstash-core-5.6.4-java/lib/logstash/patches/stronger_openssl_defaults.rb:2:in `'
./.direnv/ruby/gems/logstash-core-5.6.4-java/lib/logstash/patches.rb:5:in `'
./.direnv/ruby/gems/logstash-core-5.6.4-java/lib/logstash/environment.rb:186:in `'
./.direnv/ruby/gems/logstash-devutils-1.3.6-java/lib/logstash/devutils/rspec/spec_helper.rb:17:in `'
./spec/inputs/mongodb_spec.rb:3:in `'
------------------
--- Caused by: ---
Java::JavaLang::ClassNotFoundException:
org.jruby.util.io.FileExistsException
java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
No examples found.
Finished in 0.00108 seconds (files took 1.12 seconds to load) 0 examples, 0 failures, 1 error occurred outside of examples
Which I thin the problem is with old openssl in java 8, so I want to know how to install jruby pointing the correct SDK and the correct version of openssl
JRuby should install and work just fine with any JDK 8 or higher, so I'm not sure why you needed JDK 8 specifically.
That exception class was removed in 2020 (ab35995e5bd60cb60bdff4d6c095882dac2a6292) and the last reference to it in jruby-openssl was removed in 2018 (jruby/jruby-openssl@153028d3e4ba4ae5291670c5f6a261d9e19b562c). You are on the right track suspecting an old jruby-openssl is conflicting with the newer JRuby.
You may have it installed somewhere globally, or it is being picked up by whatever libraries/specs/code you are running. I notice LogStash mentioned in your output.
Can you provide a step-by-step reproduction, perhaps with a repository we can clone to match your environment? It's hard to know why you are getting this mismatched environment based on the output you have provided.