java graal.js interop

boris.spasojevic boris.spasojevic at oracle.com
Sun Dec 10 07:24:36 UTC 2017


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 
Hi,

I am unsure if this is the best place to post user questions about Graal.js,

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.

Best,

-Adam M.


More information about the graal-dev mailing list