About Running .class Files Created by JRuby

You have a Ruby script,

print "HELLO"

If you use

jrubyc script.rb

You get a .class file.

How to do this in my Java program? (so that it displays "HELLO" on the console). I am using JRuby full JAR.

0
source share
1 answer

that way, you probably set up a "built-in" (if not exit response, such as one ) JRuby from Java, for example. (JSR 223 may be similar - just use ScriptEngine.evalto run Ruby code):

ScriptingContainer scriptContainer = new ScriptingContainer(LocalContextScope.CONCURRENT);
scriptContainer.runScriptlet("load 'script.class'");

load.class script.class, , -/work-dir ( LOAD_PATH - Java/)

0

Source: https://habr.com/ru/post/1539854/


All Articles