Can Nashorn startup slowness be overcome?

核能气质少年 提交于 2019-11-29 06:32:23

On Java 1.8, you can use Rhino via the javax.script API by using this Maven dependency and requesting the engine rhino:

    <dependency>
        <groupId>de.christophkraemer</groupId>
        <artifactId>rhino-script-engine</artifactId>
        <version>1.1.1</version>
    </dependency>

Home page here: https://github.com/cevou/rhino-script-engine

Binaries: here

If you want the very latest version of Rhino, you can override it by adding something like this:

    <dependency>
        <groupId>org.mozilla</groupId>
        <artifactId>rhino</artifactId>
        <version>${rhinoVersion}</version>
    </dependency>

Binaries: here

Incidentally, if you want to use get the latest Rhino on Java 1.7 via javax.script, you should request the engine name rhino17R5 or you might randomly get an instance of the old Rhino which is part of the JRE. The exact engine name required depends on the version of rhino-script-engine. For 1.1.1, it is rhino17R5.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!