开发者

Passing event from C# application to Java application

I have a Java application that launches a small C# application on the client machine.

I need a simple solution for passing events between the C# and the Java applications.

To handle the opposite direction (Java->C#) I was using FileSystemWatcher, which listens to folder change events. The Java application writes an empty file to a shared folder, and the C# app handles these events according to the (empty) file name (and then removes it from the "queue"). Could not find a Java equivalent to FileSystemWatcher to solve the problem of passing开发者_StackOverflow events from C# to Java.

Any creative idea ? (reminder: this is just a Java application so I have no Apache server or something like that).

Thanks


A nice simple writeup written in 2010

Use Named Pipes to Communicate Between Java and .Net Processes


http://jni4net.sourceforge.net/

That's probably an option for you.

This seems like a duplicate of

IPC between .NET and Java client applications


I would use a simple JMS server like ActiveMQ to pass messages back and forth.


basically you need inter process communication. There are many way for it.

  • Socket
  • Named Pipes
  • Any distributed queue like RabbitMQ, ActiveMQ, e.t.c.
  • Named Mutex

http://www.ikvm.net/

e.t.c.


There are many possible ways but they generally fall into two categories:

java<->c# interop (like http://jni4net.sourceforge.net/) or some form of standardized communication like webservices (they don't require a "server" to work) such as WCF in C# and Metro on the java side.

BTW: You really shouldn't be using the file system to pass events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜