Why doesn't Sun do a C# to Java byte code compiler?

后端 未结 18 1869
清酒与你
清酒与你 2021-02-01 01:20

We Want to Run Our C# Code on the JVM

My company has a large C# code base. Well over half of this code is our core engine for creating, reading, modifying, calculating

18条回答
  •  走了就别回头了
    2021-02-01 02:02

    Firstly Sun has zero incentive to implement a C# compiler on the JVM because they have something very similar called the Java programming language.

    Its also not really as simple as just implementing a compiler as the Java standard class libraries are not the same as the .net Base Class Libraries. You would end up having to change all the .NET API calls to Java API calls.

    Micrsoft had a product called J# which was meant to be for Java to .NET conversion but in the end no one used it as the API was limited to pre Java 2 API so it was mostly useless. It would be the same if Sun implemented parts of the .NET BCL, as only the core portions of it are standardised and royalty free. Parts like ASP.NET and WPF, WCF etc are not part of the ECMA standards and so Sun would need Microsofts permission to implement those API's.

    If enough customers want a java version to make business sense to port your application to java then do it, you just wont ever get any help from Sun via a C# to JVM compiler.

提交回复
热议问题