[Mono-list] java parser in C#
jonpryor at vt.edu
Mon Apr 8 13:17:48 UTC 2013
On Apr 7, 2013, at 6:12 PM, mutasim <d_mutasim at hotmail.com> wrote:
> in this web site www.java2s.com i can find the JDK source code , the classes can be add as dll files, compiling these files will be all at one time to have full classes without error
Which is more or less what IKVM allows. IKVM is two things (possibly among others):
1. A "transpiler" that can convert Java bytecode into CIL.
2. A JVM implementation that can load Java bytecode at runtime and execute it.
(1) is required in order for (2) to work. However, (1) can also be done "ahead of time", e.g. you can take the JDK `classes.jar` and transpile it into classes.dll. Other Java code can then refer to this classes.dll (via more transpiling), and C# code can reference classes.dll and use Java types such as java.util.ArrayList.
The benefit to this approach is that you have a Real Java Compiler compiling the Java code, along with a Real Java Class Library (allowing Java code to easily execute), both of which you don't need to maintain (bonus!), and has full support for all Java language features. Furthermore, after running ikvmc.exe, there's no additional runtime overhead -- everything is CIL.
Is there any reason -- other than learning/education -- to prefer a new Java compiler based on mcs than to leverage the work of IKVM?
More information about the Mono-list