paulirwin / JavaToCSharp

Java to C# converter
MIT License
248 stars 85 forks source link

How to execute the C# code? #82

Closed alibrahimzada closed 8 months ago

alibrahimzada commented 8 months ago

I was able to translate a Java code to C#, however its using using Java.Util and I believe ikvm should be used here. How to execute a generated C# code?

alibrahimzada commented 8 months ago

I somehow managed to execute the C# program, however, the translation by itself is not complete and requires major editing. I used IKVM in .csproj file to execute the C# program.

paulirwin commented 8 months ago

@alibrahimzada Yes, that is the expected behavior. We only perform a minimal mapping to other types, and we also do not expect the users of the converted code to use a heavy Java runtime library like IKVM. The purpose of this project is only to do a syntax conversion to aid in porting code from Java to C#, not to produce a working project or assembly. There will almost always be software engineering work required on the output for transformations of any decent complexity.

If you're wanting to execute Java code on .NET, I would recommend using IKVM to run the jar. But this project is more for i.e. porting a Java library to .NET where you do not want to have to use a Java runtime, and some work will be needed to get the code working. This just does most of the heavy lifting for you. Hope this helps!