将信息从java传递给c ++的最好方法是什么? [英] What is the best way to pass information from java to c++?
本文介绍了将信息从java传递给c ++的最好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个java应用程序,我需要传递一些信息到C ++程序。有人建议我使用一些简单的套接字编程来做到这一点。这是最好的办法吗?如果没有什么是替代品?如果是这样,我应该如何去学习套接字编程?
解决方案
您有以下几种选择:
- 将文件从Java传递到C ++。这可能是最简单的。这很容易测试,不需要任何一端的任何第三方库。
- 使用如上所述的套接字。在C ++中,如果您需要跨平台解决方案库,例如 ACE 或会为您节省一些心痛。
- 使用 JNI 从Java调用到C ++,反之亦然。 /java.sun.com/docs/books/tutorial/networking/sockets/\">java socket tutorial或c ++ socket tutorial你有很多信息。
I have a java application I need to pass some info to a C++ program. It has been suggested that I use some simple socket programming to do this. Is this the best way? If not what are the alternatives? If so, how should I go about learning about socket programming?
解决方案You have a few options:
- Pass a file from Java to C++. This is probably simplest. It's easy to test and shouldn't require any 3rd party libraries on either end.
- Use sockets as mentioned. In C++, if you require a cross-platform solution a library such as ACE or boost will save you some heartache
- Use JNI to call from Java to C++ or vice versa. This is probably the most difficult, but most performant.
For learning sockets, a Google search for "java socket tutorial" or "c++ socket tutorial" will give you lots of information.
这篇关于将信息从java传递给c ++的最好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文