Search code examples
rubyjruby

can you run Java in JRuby?


Note: I'm new to this site, so if you downvote, please comment why so I can edit it and avoid it in the future

I know that you can use Java packages In JRuby, but is it possible to literally run Java in JRuby. For example, can you run Java inside a Ruby block similar to:

runJava() do 
    #Javacode
end

I did some research, but I only found how to run JRuby in Java.


Solution

  • You can certainly use java packages from JRuby. This is, in fact, one of the main jruby's selling points (if not THE main).

    And no, as far as I know, you can't run inline java code like that.