Created
October 24, 2019 00:51
-
-
Save frsyuki/7e76a413c6c63ba3dd77615fa6d67e13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.graalvm.polyglot.Context; | |
import org.graalvm.polyglot.Value; | |
public class GraalPolyglot { | |
public static void main(String[] args) { | |
try (Context context = Context.newBuilder().allowAllAccess(true).build()) { | |
Value v = context.eval("ruby", "'Ruby String'"); | |
context.getBindings("js").putMember("v", v); | |
context.eval("js", "print('v=' + v)"); //=> v=Ruby String | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment