java - How can I specify exact rhino implementation instead of that embedded to JDK? -
i use rhino script in application. found on different environments works different. example, on open-jdk code doesn't work
eval("json.stringify({id:1})")
whereas on oracle's jdk works.
this because each jdk contains it's own implementation of rhino.
i added following dependencies:
<dependency> <groupid>org.mozilla</groupid> <artifactid>rhino</artifactid> <version>1.7r4</version> </dependency>
how can specify use implementation ?
update: call rhino not directly through javax.script api
new scriptenginemanager().getenginebyname("javascript").eval("json.stringify({})")
you need implementation of javax.script.scriptengine
uses uses package org.mozilla.javascript
, rather jdk's implementation, uses repackaged sun.org.mozilla.javascript.internal
.
de.christophkraemer:rhino-script-engine such implementation, borrowed openjdk source. more details here.
Comments
Post a Comment