Javascript引擎与JVM和CLR具有良好的互操作性 [英] Javascript engine with good interoperability with JVM and CLR

查看:146
本文介绍了Javascript引擎与JVM和CLR具有良好的互操作性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于其背后的巨大资源,Javascript似乎正迅速成为应用程序的首选脚本语言,特别是那些具有Web前端的应用程序。我有一个应用程序,需要在前端和后端都可扩展。 Javascript,或像CoffeeScript这样的薄包装,似乎是一个出色的,面向未来的选择。

Due to the huge resources behind it, Javascript seems to rapidly becoming the scripting language of choice for applications, particularly those with a web front end. I have an application that requires extensibility both on the front and backend. Javascript, or a thin wrapper like CoffeeScript, seems like an excellent, future-oriented, choice.

我使用Javascript作为目标的问题是与现有服务器端库的互操作性。 V8需要自定义C ++代码。我更喜欢利用JDK / .NET类库的大量资源以及将API暴露给这些语言的代码。

The problem I'm having with using Javascript as the target is interoperability with existing server side libraries. V8 requires custom C++ code. I'd much prefer to leverage the vast resources of the JDK/.NET class libraries and our code that exposes APIs to these languages.

是否有任何可靠的努力允许用户从Javascript调用JVM / CLR库,类似于IronPython-CLR和Jython-JVM链接的优雅?

Are there any robust efforts that would allow users to call JVM/CLR libraries from Javascript, similar to the elegance of the IronPython-CLR and Jython-JVM link?

替代方法是使用类似IronPython /的东西Jython,但是这两个项目只有一小部分专用于Javascript的资源,它使得客户端可扩展性故事非常困难。

The alternative is to use something like IronPython/Jython, but both projects have only a fraction of the resources devoted to Javascript and it makes client-side extensibility story very difficult.

有没有人成功地遇到类似问题?

Has anybody successfully confronted similar issues?

推荐答案

您是否尝试过使用JDK 6(Rhino)附带的Javascript解释器?

Have you tried using the Javascript interpreter that ships with JDK 6 (Rhino)?

我的意思是,如果你问我,使用核心JDK进行交付是非常可互操作的。您可以从Javascript上下文访问Java服务,从Java端可以将对象引入Javascript全局上下文。也可以(使用ScriptEngine的东西)使用Javascript代码作为Java接口的实现。

I mean, shipping with the core JDK is pretty interoperable, if you ask me. You can access Java services from the Javascript context, and from the Java side it's possible to introduce objects into the Javascript global context. It's also possible (with the ScriptEngine stuff) to use Javascript code as implementation of a Java interface.

现在,它当然不能与CLR互操作。

Now, it's not at all interoperable with the CLR of course.

这篇关于Javascript引擎与JVM和CLR具有良好的互操作性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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