Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 and writing Excel workbooks. We frequently get questions from customers and potential customers asking whether we are going to build a Java version of our engine - many of them are not at all interested in the UI. We even have a few customers who have taken the trouble to use our .NET library from their Java applications.

So, we would like to build a Java version of our core engine, ideally without maintaining a separate Java source code base.

Eric Sink described this problem very well. I am in a similar position except for the fact that our software license includes royalty free deployment, making Eric's choice of Mainsoft a nonstarter for us.

I have been Googling the likes of "c# to jvm" every few months for several years now with no joy. Having spent ~7 years developing similar software for Java, I am confident that the .NET APIs we use in our core engine could easily be encapsulated and we could accomplish everything we need using the Java libraries. So, if we only had a C# -> JVM compiler we could build our core engine for Java and we would no longer have to turn away Java developers who would like to use it.

I am not asking for the technical reasons why Sun does not do a C# compiler. I recognize that Java has no properties or an unsigned 64 bit long, etc... For the sake of argument, just assume that all of these technical issues could be dealt with by extending the JVM and / or other means.

And I am not asking for yet another debate on why one language / stack might be better than the other. The reality in our business is that there are plenty of potential customers using each.

Why Should Sun do a C# Compiler? (IMO of course)

Making it easier to run C# code on the Java platform means more developers and more software for the platform. Is there anything more important to the success of a platform? Jonathan Schwartz is a software guy. I will leave it to others smarter than me to decide whether or not he took on an impossible job as President and CEO of Sun, but having met with Jonathan shortly after he joined Sun my impression is that he understands software and the need for a large base of developers.

So Why Doesn't Sun do a C# Compiler?

  1. NIH syndrome?
  2. The ghost of Scott McNealy?
  3. Too many Java developers dislike or distrust anything related to Microsoft?
  4. They agreed not to as part of taking the big bucks?
  5. ???

There must be a good reason. I just cannot for the life of me figure out what it is...

like image 625
Joe Erickson Avatar asked Jan 30 '09 03:01

Joe Erickson


People also ask

Can an air conditioner be in the sun?

Bottom line: Keeping your AC unit out of direct sunlight can cut operating costs and improve performance. However, even the most effective shading can't overcome a sluggish central air system. Make sure your air conditioner is operating at peak efficiency with routine maintenance.

Is the sun on air con for heat?

The Sun: used for warm air or heat mode. The Snowflake: used for cold air or cool mode. The Raindrop: used for dry mode. This should be used when the conditions are humid, and temperatures are mild.

Why is AC not a thing in Europe?

Electricity costs more in Europe, with prices in Germany and Denmark more than twice as high as in the U.S. Average incomes are similar between the U.S. and parts of Europe, but in other parts, salaries are much lower than those in the U.S., making air conditioning less affordable.

Does an air conditioner work better in the sun or shade?

According to a study by the Department of Energy, outdoor AC units that are shaded by trees or artificial structures are 10% more efficient, which can save you hundreds of dollars in yearly cooling costs.


1 Answers

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.

like image 168
Tim Avatar answered Oct 14 '22 22:10

Tim