Skip to content

Instantly share code, notes, and snippets.

@shelajev
Created June 10, 2018 23:37
Show Gist options
  • Select an option

  • Save shelajev/fc3f0b5979c2a3c5990332f632440c2b to your computer and use it in GitHub Desktop.

Select an option

Save shelajev/fc3f0b5979c2a3c5990332f632440c2b to your computer and use it in GitHub Desktop.
PolyglotTest.java
public class PolyglotTest {
public static void main(String[] args) {
System.out.println("Hello World from Java!");
org.graalvm.polyglot.Context context =
org.graalvm.polyglot.Context.newBuilder().allowAllAccess(true).build();
context.eval("js", "print('Hello World from JavaScript!');");
// context.eval("python", "print('Hello World from Python!')");
// context.eval("R", "print('Hello World from R!')");
// context.eval("ruby", "puts 'Hello World from Ruby!'");
context.close();
try { Thread.sleep(300000); }
catch (InterruptedException e) {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment