<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Christian,<div class=""><br class=""></div><div class="">thanks. After adding the jars to the classpath, the engine was available.&nbsp;</div><div class=""><br class=""></div><div class="">However, I’m getting this while evaluating a script:</div><div class=""><br class=""></div><div class="">javax.script.ScriptException: org.graalvm.polyglot.PolyglotException: TypeError: INVOKE on JavaObject[IntervalTimer{name='scheduler', millis=0}&nbsp;(com.swiftmq.impl.streams.comp.timer.IntervalTimer)] failed due to: UnsupportedTypeException<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:183)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:155)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>at com.swiftmq.impl.streams.StreamController.evalScript(Unknown Source)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>at com.swiftmq.impl.streams.StreamController.start(Unknown Source)<br class=""><br class=""></div><div class="">The script does this:</div><div class=""><br class=""></div><div class="">stream.create().timer("scheduler").interval().seconds(interval).onTimer(function (timer) {<br class="">...</div><div class="">}</div><div class=""><br class=""></div><div class="">The Java class “IntervalTimer” has this “seconds” and “onTimer" methods:</div><div class=""><br class=""></div><div class="">public&nbsp;IntervalTimer seconds(int&nbsp;n) {<br class="">&nbsp; &nbsp;&nbsp;millis&nbsp;+= (long) n *&nbsp;1000L;<br class="">&nbsp; &nbsp;&nbsp;return this;<br class="">}<br class=""></div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; @Override<br class="">&nbsp; &nbsp; public Timer onTimer(TimerCallback callback) {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; this.callback = callback;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; return this;<br class="">&nbsp; &nbsp; }<br class=""><br class=""></div><div class=""><br class=""></div><div class="">Any hints?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Andreas</div><div class=""><br class=""><div class="">--&nbsp;<br class="">Andreas Mueller<br class="">IIT Software GmbH<br class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.swiftmq.com&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=TP6vDFIvOwHIJubzP5a3mC1OLNpov_7VuXVjRKUILpY&s=9FM150Blv30fDT3EnnLT4BX13ZpAdhoPfJbyD5QbUwM&e=" class="">http://www.swiftmq.com</a><br class=""><br class=""><span><img height="100" width="452" apple-inline="yes" id="CE513DC8-9F8B-491C-A567-8A6EE03FCA82" apple-width="yes" apple-height="yes" src="cid:D8D52512-246D-49DF-A1D7-CA2813FBD86A@multi.box" class=""></span><br class=""></div><br class=""><blockquote type="cite" class="">On 22 Jun 2018, at 09:48, Christian Wirth &lt;<a href="mailto:christian.wirth@oracle.com" class="">christian.wirth@oracle.com</a>&gt; wrote:<br class=""><br class="">Hi Andreas,<br class=""><br class="">currently, we strongly endorse the use of GraalVM. That guarantees&nbsp;that you use Graal JavaScript with Graal as optimizing compiler.<br class=""><br class="">What you tried to achieve will work; note, however, that in such a&nbsp;setup (on JDK 8) Graal is NOT used as optimzing compiler (but&nbsp;HotSpot Server Compiler C2 is), thus the&nbsp;performance of Graal&nbsp;JavaScript will likely be much worse than it would be on GraalVM.&nbsp;<br class=""><br class="">Your commandline was probably missing the&nbsp;$GRAALVM/jre/lib/boot/graaljs-scriptengine.jar file? I am using a&nbsp;commandline like:<br class=""><br class="">&nbsp; &nbsp;GRAALVM=/path/to/GraalVM<br class="">&nbsp; &nbsp;/path/to/jdk8/bin/java -cp&nbsp;$GRAALVM/jre/languages/js/graaljs.jar:$GRAALVM/jre/lib/truffle/truffle-api.jar:$GRAALVM/jre/lib/boot/graal-sdk.jar:$GRAALVM/jre/lib/boot/graaljs-scriptengine.jar:$GRAALVM/jre/tools/regex/tregex.jar:.&nbsp;MyJavaApp<br class=""><br class="">In MyJavaApp, you can start Graal JavaScript via ScriptEngine; it&nbsp;registers under several names, including "graal.js". Again, note&nbsp;that performance will be suboptimal this way;&nbsp;use GraalVM for better&nbsp;results.<br class=""><br class="">For JDK 11 and beyond, you can execute Graal JavaScript with Graal&nbsp;as optimizing compiler on a stock JVM already. We are currently&nbsp;working on improved&nbsp;packaging/modularizing and should be able to&nbsp;publish some documentation on that in the coming weeks.<br class=""><br class="">Best,<br class="">Christian Wirth<br class="">Graal JavaScript team<br class=""><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">From:&nbsp;Andreas Mueller &lt;<a href="mailto:am@iit.de" class="">am@iit.de</a>&gt;<br class="">Subject:&nbsp;[graalvm-users] Migrate&nbsp;from Nashhorn JSR 223 Scripting Engine to Graal<br class="">Date:&nbsp;18 June 2018 at 15:05:22 CEST<br class="">To:&nbsp;graalvm-users@oss.oracle.com<br class=""><br class="">Hi,<br class=""><br class="">I was cold hitted by the announcement that&nbsp;Nashorn might be deprecated in future. Since we have a&nbsp;lot JS scripts implemented that run on the JVM and&nbsp;interact with Java very&nbsp;well, I need an alternative JSR&nbsp;223 JavaScript engine. So GraalVM comes to mind (and is&nbsp;suggested).<br class=""><br class="">GraalVM seems to me a JDK replacement rather&nbsp;than a scripting engine. I downloaded it but didn’t find&nbsp;a jar file (such as graaljs.jar) that contains the JSR&nbsp;223 engine and that&nbsp;I just add to the classpath of a&nbsp;legacy JDK 1.8.x and then it is automatically available&nbsp;when I list the engines.<br class=""><br class="">Can anybody tell me how I can achieve this?<br class=""><br class="">Thanks,<br class="">Andreas<br class=""><br class="">--&nbsp;<br class="">Andreas Mueller<br class="">IIT Software GmbH<br class="">http://www.swiftmq.com<br class=""><br class=""><span id="cid:part4.1121624D.1730F500@oracle.com">&lt;swiftmq_logo_positiv.png&gt;</span><br class=""><br class=""><br class=""><br class="">IIT Software GmbH<br class="">Falkenhorst 11, 48155 Münster, Germany<br class="">Phone: +49 (0)251 39 72 99 00<br class="">Managing Director: Andreas Müller<br class="">District Court: Amtsgericht Münster, HRB 16294<br class="">VAT-No: DE199945912<br class=""><br class="">This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender&nbsp;immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.<br class="">_______________________________________________<br class="">GraalVM-Users mailing list<br class="">GraalVM-Users@oss.oracle.com<br class="">https://oss.oracle.com/mailman/listinfo/graalvm-users<br class=""></blockquote><br class="">_______________________________________________<br class="">GraalVM-Users mailing list<br class=""><a href="mailto:GraalVM-Users@oss.oracle.com" class="">GraalVM-Users@oss.oracle.com</a><br class="">https://oss.oracle.com/mailman/listinfo/graalvm-users<br class=""></blockquote><br class=""></div><BR />
<BR />
<HR />
IIT&nbsp;Software&nbsp;GmbH<BR />
Falkenhorst&nbsp;11,&nbsp;48155&nbsp;Münster,&nbsp;Germany<BR />
Phone:&nbsp;+49&nbsp;(0)251&nbsp;39&nbsp;72&nbsp;99&nbsp;00<BR />
Managing&nbsp;Director:&nbsp;Andreas&nbsp;Müller<BR />
District&nbsp;Court:&nbsp;Amtsgericht&nbsp;Münster,&nbsp;HRB&nbsp;16294<BR />
VAT-No:&nbsp;DE199945912<BR />
<BR />
This&nbsp;e-mail&nbsp;may&nbsp;contain&nbsp;confidential&nbsp;and/or&nbsp;privileged&nbsp;information.&nbsp;If&nbsp;you&nbsp;are&nbsp;not&nbsp;the&nbsp;intended&nbsp;recipient&nbsp;(or&nbsp;have&nbsp;received&nbsp;this&nbsp;e-mail&nbsp;in&nbsp;error)&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;destroy&nbsp;this&nbsp;e-mail.&nbsp;Any&nbsp;unauthorized&nbsp;copying,&nbsp;disclosure&nbsp;or&nbsp;distribution&nbsp;of&nbsp;the&nbsp;material&nbsp;in&nbsp;this&nbsp;e-mail&nbsp;is&nbsp;strictly&nbsp;forbidden.<BR />
</body></html>