我如何在Java中使用JavaScript? [英] How can I use Javascript in Java?

查看:176
本文介绍了我如何在Java中使用JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个小的产品中,我想给一种功能,其中用户可以编写一个脚本语言JavaScript的那种的。

I wanted to build a small product in which I wanted to give a kind of feature in which user can write a script language kind of javascript.

和还从JavaScript能够建立他们的对象和调用方法。

And also from javascript able to build objects and calling methods on them.

有没有框架呢?

推荐答案

犀牛是你在找什么。

犀牛完全是写了一个JavaScript的开源实现
  在Java中。它通常嵌入到Java应用程序,以提供
  脚本到最终用户。

Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users.

更新:
现在犀牛,这是更高性能JavaScript引擎对Java,可与jdk8。

Update: Now Nashorn, which is more performant JavaScript Engine for Java, is available with jdk8.

这篇关于我如何在Java中使用JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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