Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i call a java class in ruby

How can i call a java class in ruby?

like image 776
zhessy Avatar asked Dec 30 '22 07:12

zhessy


2 Answers

If you use JRuby, you can

require 'java'

and then instantiate a Java class using eg

object = Java::package.package.ClassName.new

and then call methods using

object.method(parameter)

for more information, see Scripting Java libraries with JRuby

like image 193
akuhn Avatar answered Jan 09 '23 07:01

akuhn


try this Java/Ruby Bridge:

Link

The Bridge itselfs enables you to load java classes into your ruby Code.

like image 40
bastianneu Avatar answered Jan 09 '23 08:01

bastianneu