为什么公共语言运行时不能支持Java

编程入门 行业动态 更新时间:2024-10-23 08:41:11
本文介绍了为什么公共语言运行时不能支持Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

今天,公共语言运行时支持多种语言,包括Iron Python和Iron Ruby。我们同样可以在Java Run Time环境中使用J Ruby和J Python。如果是这样的话。为什么框架工作的公共语言运行时间不能支持Java?你只是好奇地知道你可能会认为这是一个愚蠢的问题。

Today the Common Language Run Time Supports Many Languages including Iron Python and Iron Ruby. We can similarly can use J Ruby and J Python in Java Run Time environments . If so why the frame work common language run time cannot support for Java? Um just curious to know though u may see this as a dumb question .

推荐答案

CLR的实际设计是为了让可以完成运行Java所需的一切。 (实际上,定义IL的方式有一些瑕疵,它们专门用于与Java兼容。)您只需要一种将字节码转换为IL,或者从Java源代码编译为IL的方法。 J#是这样做的一种方式,但使用Java 1.1.4的限制是非常大的。

The CLR was actually designed so that it could do everything required to run Java. (Indeed, there are some warts in the way IL is defined which are there specifically for compatibility with Java.) You just need a way of converting bytecode to IL, or compiling from Java source code to IL. J# was one way of doing this, but the limitation of using Java 1.1.4 was a pretty huge one.

我怀疑不进一步的原因不是将Java作为语言运行的问题,但系统库需要移植的事实。如果您愿意编写类似Java的源代码但是目标是.NET框架库(以及仅 .NET框架库),那么使用JLS版本切换 java.lang .String 到 System.String 等,这是可行的。我不认为当C#在几乎所有方面都是一种更好的语言时会有很多好处。

I suspect the reason for not going further wasn't an issue with running Java as a language, but the fact that system libraries would need porting. If you were willing to write Java-like source code but target .NET framework libraries (and only .NET framework libraries), with a version of the JLS which switched java.lang.String to System.String etc, it would be doable. I don't think there'd be much benefit though, when C# is simply a nicer language in almost all ways.

你可能有兴趣看一下 IKVM.NET - 在CLI上运行的Java实现。

You may be interested in looking at IKVM.NET though - an implementation of Java running on the CLI.

更多推荐

为什么公共语言运行时不能支持Java

本文发布于:2023-10-31 04:56:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545066.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语言   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!