简体   繁体   English

如何在C#(或C ++)和JAVA之间进行通信

[英]how to communicate between C# (or C++) and JAVA

i am working on a RFID based project in which we should communicate with Gates(RFID tag reader is called a GATE) through our application (and we are using java 2 ee to do this). 我正在一个基于RFID的项目中,我们应该通过我们的应用程序与Gates(RFID标签阅读器称为GATE)进行通信(并且我们正在使用java 2 ee进行此操作)。 the problem is the Gates are only shipping with c# and c++ SDK. 问题是盖茨仅随c#和c ++ SDK一起提供。 what is your solution to communicate between c++ / C# and java? 在C ++ / C#与Java之间进行通讯的解决方案是什么? is there any so called convertor that can ease the pain? 有没有所谓的转换器可以减轻痛苦? and this is the Gates manufacturer website if you need any more info : http://www.marktrace.com/en/default.html 如果您需要更多信息,这是盖茨制造商的网站: http : //www.marktrace.com/en/default.html

thank you all. 谢谢你们。

You are searching for the Java native interface which allows you to communicate with other libraries. 您正在搜索Java本机接口 ,该接口允许您与其他库进行通信。

You can either call methods from an external DLL and call Java methods from within your C++ code. 您可以从外部DLL调用方法,也可以从C ++代码内部调用Java方法。

You can use jni4net to have a bridge to .NET libraries as well. 您也可以使用jni4net与.NET库建立桥梁。

除了使用其他答案提到的JNI之外,我还在写一个类似的拼贴程序,我们只是编写了一个C#客户端,与该库进行通信,然后通过在C#中编写一个简单的TCP服务器(与主要Java应用程序进行通信)来弥合Java的鸿沟。至。

JNI - Java Native Interface - You can use it to call C++ code from Java. JNI-Java本机接口-可以使用它从Java调用C ++代码。 http://docs.oracle.com/javase/6/docs/technotes/guides/jni/ http://docs.oracle.com/javase/6/docs/technotes/guides/jni/

Here is a tutorial . 这是一个教程

Java Native Interface is what you need. 您需要Java本机接口 There are also couple of alternatives and specific libs 还有一些替代方案和特定的库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM