views:

409

answers:

3

I need to pull some data from java into C#. I am already exposing my C# classes via COM. So I thought a good way to pull data from java would be to expose IReadStream from C# and implement IReadStream in java. I can then send an instance of the implementation as a parameter to C# so that I can call IReadStream.Read in C#.

How do I implement a custom COM interface in java?

A: 

I don't know if it supports this direction, but Jacob is a Java COM Bridge that's frequently mentioned.

Also, using IKVM to run the Java code might make the task significantly easier.

Joachim Sauer
thanks, i know about jacob. don't think it support what i want to do
Ries
A: 

Using COM sounds overly messy whats wrong with exposing your c# code via a socket and have java suck that down.

mP
A: 

I went for named pipes in the end.

On the java side I write into a named pipe (served from the c# side). In c# i should now be able to read from the named pipe. As long as the Read operation is blocking it should be the same as pulling data from java.

See http://www.codeproject.com/KB/threads/dotnetnamedpipespart1.aspx for a c# wrapper around the Named pipes api calls.

Ries