4

I'm working on a project that uses an RFID reader, which only works with a library in C#. The thing is I'd really like to work with Java (develop the rest of the program, GUI, etc), and use the C# program just to ask the reader to read the information and return a string to the Java program.

So, is there a way I could do this?

Thanks in advance.

  • Possible duplicate of: http://stackoverflow.com/questions/468198/consuming-a-net-library-via-com-or-direct-integration-in-java – kubal5003 Nov 04 '11 at 23:42

3 Answers3

1

One way to approach this is to look at it as a problem of interprocess communication. There are a bunch of options (assuming Java has access to the necessary Windows API's which I'm assuming it does, but I'm not really a Java dev).

Named Pipes, TCP/IP, Filesystem, Mailslots, etc.

Here's a good article on some options: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx

Another option, which I don't know enough to speak about, is trying to load a .Net library into your java process.

Dylan Smith
  • 22,069
  • 2
  • 47
  • 62
  • Thanks for the tips. The one i found most usable, among those which you listed, were the Named Pipes. Though, would it be an issue that the processes are in different computers? And as far as I read, there are no flow control protocols in it, are there? – Patrick Toy Nov 06 '11 at 15:51
1

Couldn't you use sockets? They both do support it, but I never tried to do it between different languages.
Good luck.

11684
  • 7,356
  • 12
  • 48
  • 71
0

If you don't mind delving too deep you could use the Java Native Interface to generate code to marshall calls from Java to C# and back again. You'd need to build a "bridge" in c/c++ (c++ is generally slightly easier).

This way you get in-process communication, which is the fastest way to work :-)

RB.
  • 36,301
  • 12
  • 91
  • 131