Dotnet CLR converts the language code to MSIL. While Java Code be converted to Native Code that is platform independent. Can we convert this MSIL to Native Code ? So the Dotnet will automatically become platform independent.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Be careful about your terminology here:
Note that both MSIL and bytecode can be interpreted; HotSpot will sometimes interpret, sometimes JIT compile, and often JIT compile multiple times. The .NET desktop CLR always JIT compiles a single time at the moment.
It’s also worth understanding that bytecode is only platform independent to the extent that there is a JVM available for the platform you’re interested in. The same is true for MSIL. You can compile a C# program on Windows and then run it on Linux under Mono if there’s a build of Mono for your platform and if it doesn’t use any libraries which aren’t available on Mono.
Now as for converting MSIL to Java bytecode… the reverse is more feasible, as MSIL is generally more powerful than Java bytecode. For example, custom value types and generics in MSIL wouldn’t translate easily into bytecode. You’d probably need something closer to a CLR written in Java. I dare say there are some clever possibilities, but there are fundamental difficulties there. Even the reverse is unlikely to be easy – especially if Java 7 introduces dynamic invocation to bytecode (whereas dynamic typing in .NET is performed by the DLR just as a library).