Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the jruby version at runtime?

I need to get the jruby version for logging & debugging purposes.

I tried looking around JRuby.runtime for a version method, but I didn't find anything useful.

I also thought about using %x{jruby -v}. It works in most cases, except that there is always the possibility that more than one jruby version are installed, and I want to get the version of the currently running interpreter.

Did I miss something? Any suggestion?

like image 574
Eldritch Conundrum Avatar asked Dec 31 '25 02:12

Eldritch Conundrum


1 Answers

You are looking for the global constant JRUBY_VERSION. This is a brother of VERSION, RUBY_ENGINE (not available under 1.8.x), RUBY_PLATFORM, etc.

like image 100
Confusion Avatar answered Jan 02 '26 19:01

Confusion



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!