These are chat archives for jruby-gradle/jruby-gradle-plugin

Apr 2016
Apr 25 2016 16:19
I am trying to execute the jar (main class) from scala. Any ideas how I can do that?
I was able to import it from scala, but I can't execute it because scala doesn't support static methods
import org.jruby.mains.JarMain works fine

```scala> import org.jruby.mains.JRubyMain
import org.jruby.mains.JRubyMain

res0: String = META-INF/jar-bootstrap.rb

Is there another endpoint I can execute the code without using the main method from JarMain?
Christian Meier
Apr 25 2016 16:24
just have a look at the static main method in JRubyMain - it just uses an instance of the JRubyMain class to execute everything
anyways much nicer to handle all these exceptions and System.exit manually
R. Tyler Croy
Apr 25 2016 17:49
@pngdwld scala doesn't let you execute static methods? O_O
that java interop must be unpleasant
Apr 25 2016 19:29
Thanks. I will give that a try.
Also, do you know how I can pass objects / string from jruby to java?
Christian Meier
Apr 25 2016 19:34
well, the main method is not really the right thing for getting results from jruby. you should use embedded jruby, i.e. use an instance of the IsolatedScriptingContainer. look for docu on redbridge-jruby (they use ScriptingContainer but the IsolatedScriptingContainer is more isolated from your OS environment)