-
Notifications
You must be signed in to change notification settings - Fork 16
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
Launcher can't find JAVA_HOME running with Linux alternatives #31
Comments
Thank you @headius, I'll play around to figure out the proper value of It seems to me from what you wrote that it would be enough to resolve the real location of |
@deivid-rodriguez I am doing a spike of writing this launcher in rust. What is described with alternatives is a single function (fs::canonicalize(path)) and if we do continue with the existing launcher it will likely need to be readlink in a loop since /usr/bin/java -> /etc/alternatives/java -> /the/actual/location. |
@enebo Ruby's
And the workaround works, by the way! 🎉
|
Another way to get JAVA_HOME:
We are probably not going to go further with this in the existing launcher codebase since the new Rust-based launcher has been coming along well. I would recommend anyone using JRuby have a JAVA_HOME set until we have the newer, smarter launcher to handle that for you. |
I'm using the > echo $JAVA_HOME
/usr/local/openjdk-11
> which java
/usr/local/openjdk-11/bin/java
> JAVA_HOME=/usr/local/openjdk-11/ jruby -e "puts 1"
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules to method sun.nio.ch.NativeThread.signal(long)
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
1 However, when I execute |
@nfrankel What version of JRuby is in that docker image? We were supposed to take over maintenance but have not had time to do so. It may be out of date. |
ruby --version
|
😬 Yikes, ok, we need to get those images taken over and updated to latest JRuby. Workaround for now would be to manually force a newer JRuby by downloading or installing it in the container. |
No worries, I can live with a warning until the new image is provided. Thanks for the feedback! |
The docker images seem up to date though: https://hub.docker.com/_/jruby/. I think you need to |
Thanks for the hint @deivid-rodriguez. The image was from 5 months ago, there's indeed a new one... and a new warning message.
On a meta level, this raises the question as to why the tag may reference different image hashes over time. Since it's the second time I encounter this behavior, I'm less surprised, but I do think this is not a good idea. |
You have different options for specifying your base docker image, which go from yours, Regarding the warning, you can also try upgrading the jruby-openssl gem to 0.10.5. |
@deivid-rodriguez Makes sense, thanks for the explanation |
Most of the issues reported under jruby/jruby#6049 appear to be due to the fact that we can't detect that the JDK being used supports modules.
Normally if you have JAVA_HOME set to the location of your JDK, we will look for JAVA_HOME/jmods to determine that the JDK supports modules. In some scenarios, only
java
will be in path. The logic at present assumes thatjava
is under JAVA_HOME/bin, and infers JAVA_HOME From that path. Unfortunately on most Linux distributions,java
is installed as a link in /usr/bin, so we can't determine from that path where JAVA_HOME is actually located.I believe we need a more robust mechanism to determine that the target JDK supports modules.
The workaround for now is to set JAVA_HOME. On most Linux distributions, there will be commands you can run to get the location of the default JDK installation. The JDKs are also usually installed under /usr/lib/jvm; paths there are suitable for JAVA_HOME (just make sure they match the default version of Java run by /usr/bin/java).
The text was updated successfully, but these errors were encountered: