views:

97

answers:

3

I want to develop a certain plugin/extension, which needs to run in eclipse and has to integrate with another (java) plugin, but it has to collect data from .NET assemblies (using mono's cecil).

So my question is how should I create this relation between the Java code and the .NET? I know that I could use mono to run the .net application on for instance Linux, but I have 2 problems, I would like that the Java plugin starts the .NET application, and the second problem how to let the Java plugin make certain calls to the .NET application.

For this communication between these two applications, I would like to be platform independent so that the same binaries could run in both Windows, OSX and Linux. Another perhaps important fact is that the results of the calls could contain pretty big collection of objects.

Or perhaps it would be better/possible to host a .NET assembly inside of java and call it directly?

Update: I think an ideal answer would solve the following questions:

  • How to start/invoke the .NET assembly/application from the Java side. (cross platform)
  • How to communicate with the .NET assembly
  • What impact these choices have on the modifiability
+1  A: 

You could use Tcp/Ip to let them communicate

DaVinci
+5  A: 

Communication between applications.

How to let a java application communicate with a .net application

Transportation

How to transport information between java and .net applications.

  • Sockets - connections can be left open and both sides can send stuff (= act as client)
  • WebServices - no connections are kept open, event handling will not work very well

Serialization

How to convert objects into something that can easily be transported.

  • Plain XML - Easy to get started. Both java and .net have great XML support
  • SOAP - Great if you want to expose an API for everyone to use. A bit complex.
  • Protobof - Googles serialization protocol. Lot's of different implementations exist.
  • Custom made binary serialization - Built your own serialization library

How to load a .net assembly from java

Run the java application in mono ;)

http://www.ikvm.net/

jgauffin
I wouldn't want to impose the user of the plugin to load eclipse in mono ;)
Davy Landman
Although it is doable :-) http://developers.slashdot.org/article.pl?sid=03/05/10/2127222
skolima
That's just eclipse running.. not to mention all those plugins ;) but no, I wouldn't see ikvm as a solution for this problem.
Davy Landman
A: 

It would be possible to use IKVM (see http://www.ikvm.net/, another answer has mentioned it) for this.

However, instead of completely running Eclipse on IKVM on Mono, you could probably just write a Java plug-in for Eclipse and use IKVM for one of the following:

  • Do conversions of the .NET components at runtime using library calls to IKVM and then load the converted components into the JVM.
  • Do runtime interop using IKVM. However, it don't think it was designed for that, so it might not support that (or be highly undocumented).
Deckard
If i'm not mistaken, IKVM translates the java code to .NET, not the other way around.
Davy Landman