diff --git a/part-16/src/main/java/com/endoflineblog/truffle/part_15/Main.java b/part-16/src/main/java/com/endoflineblog/truffle/part_15/Main.java new file mode 100644 index 00000000..a2e5d935 --- /dev/null +++ b/part-16/src/main/java/com/endoflineblog/truffle/part_15/Main.java @@ -0,0 +1,23 @@ +package com.endoflineblog.truffle.part_15; + +import org.graalvm.polyglot.Context; +import org.graalvm.polyglot.Source; +import org.graalvm.polyglot.Value; + +import java.io.File; +import java.io.IOException; + +public class Main { + public static void main(String[] args) throws IOException { + Source source = Source + .newBuilder("ezs", new File("src/main/resources/example.js")) + .build(); + + try (Context context = Context + .newBuilder() + .build()) { + Value result = context.eval(source); + System.out.println(result.toString()); + } + } +} diff --git a/part-16/src/main/resources/example.js b/part-16/src/main/resources/example.js new file mode 100644 index 00000000..a31eda83 --- /dev/null +++ b/part-16/src/main/resources/example.js @@ -0,0 +1 @@ +"example.js";