我如何开始使用Oracle的Nashorn JS引擎进行编码,何时在OpenJDK中取代Rhino? [英] How can I start coding with Oracle's Nashorn JS Engine and when will it replace Rhino in the OpenJDK?

查看:78
本文介绍了我如何开始使用Oracle的Nashorn JS引擎进行编码,何时在OpenJDK中取代Rhino?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种开始使用Oracle新的Nashorn JavaScript引擎的方法.我用DL发行了最新的OpenJDK 8(b65),看来Rhino仍然是唯一包含的脚本引擎.

I'm looking for a way to start playing around with Oracle's new Nashorn JavaScript Engine. I've DL'd the latest OpenJDK 8 (b65) and it appears that Rhino is still the only included script engine.

任何人都知道Nashorn何时(或在哪个版本中)将在OpenJDK中取代Rhino?甚至更好的是,在哪里可以得到包含它的JDK?我知道Netbeans已经编写了一个调试器来使用它,只是不确定它们从何处获得了开始编写它的库/代码.

Anyone know when (or in which build) Nashorn will replace Rhino in the OpenJDK? Or even better, where I can get a JDK with it included already? I know Netbeans has already written a debugger to use it, just not sure where they got the libraries/code to start writing it.

有人有一些链接吗?

谢谢.

推荐答案

在OpenJDK上似乎没有Nashorn的迹象.

It looks like there is no sign of Nashorn on OpenJDK yet.

吉姆·拉斯基(Jim Laskey)在2012年10月发表的最新评论表明,2012年第四季度:

The most recent comment from Jim Laskey in Oct 2012 suggests Q4 2012:

https://blogs.oracle.com/nashorn/entry/welcome_to_the_nashorn_blog#comment-1351205506968

我认为现在是时候进行在SO上标记!

I think it is time for a nashorn tag on SO!

2012年12月1日更新:

好像OpenJDK在2012年12月下旬可能拥有它 https://blogs.oracle.com/nashorn/entry/request_for_project_nashorn_open

Looks like late Dec 2012 OpenJDK may have it https://blogs.oracle.com/nashorn/entry/request_for_project_nashorn_open

2013年3月10日更新:

@Seth是正确的,因为 1.7版本3 PRERELEASE 不是Nashorn.我的错!

@Seth is correct that 1.7 release 3 PRERELEASE is not Nashorn. My mistake!

JDK 8 b68 包含尚未合并的

JDK 8 b68 includes a yet to be merged nashorn~jdk8 branch.

该分支的自述文件说:

Nashorn存储库正在迁移到OpenJDK的过程中,因此在几个方面不完整.构建系统未完全集成.完成后,Nashorn将安装在JRE中的正确位置.集成后,将包装正确版本的JDK纳斯霍恩.同时,请确保使用JDK8 b68或更高版本.

The Nashorn repo is in the process of being migrated to OpenJDK and as such is incomplete in several areas. The build system is not fully integrated. When complete, Nashorn will be installed in its proper location in the JRE. Once integrated, the correct version of the JDK will be wrapped around Nashorn. In the meantime, ensure you use JDK8 b68 or later.

如果您从源代码中签出 nashorn〜jdk8 ,则可以构建 nashorn.jar

If you checkout nashorn~jdk8 from source you can build nashorn.jar

cd nashorn~jdk8/nashorn/make
ant clean; ant

您可以在最近的jdk 1.8版本中从 javax.script.ScriptEngineManager 请求"nashorn"引擎:

You can request the "nashorn" engine from javax.script.ScriptEngineManager in a recent jdk 1.8 build:

jrunscript -cp ./nashorn.jar -l "nashorn" -e "println(engine.factory.getParameter(
    javax.script.ScriptEngine.ENGINE))"
> Oracle Nashorn

或在路径中使用 nashorn.jar :

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("nashorn");


2014年3月19日更新:

从@ncasas更新; JDK 8已退出,而Nashorn是默认的JS引擎.

Update from @ncasas; JDK 8 is out and Nashorn is the default JS engine.

这篇关于我如何开始使用Oracle的Nashorn JS引擎进行编码,何时在OpenJDK中取代Rhino?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆