There was a small question about accessing Java from C #. Specifically interested in how to push the JVM from under C #, and even the conversion from the screw to the java. About Java -> C # found a small article on Habré ( tyts ), but frankly I didn’t understand anything about calls from under C # to Java code. xD

In the same place, on Habré, I found an article on accessing Java from crosses ( tyts ) and the article is quite interesting (for it implies the creation of a "glue" library, yes). But, I did not find anything anywhere (maybe I was looking badly, of course), it’s like using C # using the same JNI (or not, I’m just not aware of other methods) to run the JVM and send the program written in Java to work. Plus, of course, while the code is running, I need to somehow interact with it from the C # code (in general, generally C # <-> Java).

Throw, please, articles about this. Ideally - step by step instructions. Quite ideally - with explanations for each step. Thank you very much in advance.

  • one
    In C #, Pinvoke is used. - free_ze

2 answers 2

There is such a project IKVM - JVM implementation on .NET. It can dynamically connect .jar files, or recompile .jar to .NET assemblies ( .dll )

The command to recompile .jar to .dll :

ikvmc -target: library mylib.jar

    Any convenient form of interprocess communication .

    • Not exactly what I was looking for, because I’m more interested in the consciousness of the "monolithic" program with the connection of several languages ​​and the organization of their communication through native, rather than the launch of several programs and the organization of their communication in this "any convenient form." But, in general, it is also necessary, thank you. - Abnormally
    • 2
      @NetScum Monolithic program you will not succeed, at least because applications must be hosted on their virtual machines (two different processes). Although, you can google the implementation of Java on CLR, and write / call assemblies within the CLS, but the game is unlikely to be worth the candle. - free_ze
    • @NetScum You can go down to COM. There will be no problems with sisharp, but Java ... Well, there will be no talk about cross-platform. - free_ze
    • @free_ze everything will turn out. - hazzik