从C ++访问Java类的最佳方法? (比直接使用JNI更好) [英] Best way to access Java classes from C++? (better than using JNI directly)

查看:149
本文介绍了从C ++访问Java类的最佳方法? (比直接使用JNI更好)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在一个非常大的C ++应用程序中集成一个大型Java库。解决方案是使用JNI,但这需要手动编写所有类的代码。例如,Python有一个很好的JPype解决方案( http://jpype.sourceforge.net/ )自动化过程(尽管由于C ++和Python的不同性质,相同的解决方案不能应用于C ++)。

I have to integrate a large Java library in a quite large C++ application. A solution is to use JNI but this requires to hand code all the classes. Python has, for example, a wonderful solution with JPype (http://jpype.sourceforge.net/) that automatizes the process (although the same solution cannot be applied to C++ due to C++ and Python different natures).

谢谢,

Das

推荐答案

SWIG 是一种工具,可让您自动生成从一种语言到另一种语言的绑定。它支持C ++和Java以及其他十几种语言。

SWIG is a tool that lets you auto-generate bindings from one language to another. It supports C++ and Java and a dozen other languages.

这篇关于从C ++访问Java类的最佳方法? (比直接使用JNI更好)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆