java graal.js interop
adam at cs.miami.edu
Sun Dec 10 08:46:22 UTC 2017
Thanks for the heads-up, that works well with the --jvm option.
However, when I add the --jvm option, I noticed that pure JS code ran much
slower (not just a slower startup, which was expected, but slower execution
of pure JS). I can provide an example, if needed, but this was unexpected
to me as an end user. --polyglot did not slow down the JS execution.
it seems odd to me that just including the JVM as an option would slow down
the Graal.js execution of pure JS.
On Sun, Dec 10, 2017 at 2:24 AM, boris.spasojevic <
boris.spasojevic at oracle.com> wrote:
> Hey Adam,
> I am also unsure if this is the best place to answer user questions about
> Graal.js but here goes :)
> Without going into to much detail, js executes on SVM by default. You need
> to run js with --jvm in order to execute on the JVM and have access to Java.
> So: "js --jvm myscript.js"
> If you need access to the other truffle languages add --polyglot.
> "js --polyglot myscript.js" which will run on SVM with polyglot enabled.
> If you want Java + other languages just add both:
> "js --jvm --polyglot myscript.js"
> Hope that helps.
> Sent from my Samsung Galaxy smartphone.
> -------- Original message --------
> From: Adam McMahon <adam at cs.miami.edu>
> Date: 12/10/17 02:27 (GMT+01:00)
> To: graal-dev at openjdk.java.net
> Subject: java graal.js interop
> I am unsure if this is the best place to post user questions about
> I am not able to get the JS examples working that use Java. I get the
> following error:
> ReferenceError: Java is not defined
> It seems that Java.type(String), is not defined. I am running Graal.js by
> using "js myscript.js" on Ubuntu 16, graalvm-0.30.
> -Adam M.
More information about the graal-dev