我无法导入最初用 C++ 编写但具有 Java 本地绑定(bind)的库。这里是图书馆https://github.com/NationalAssociationOfRealtors/libRETS ,我能够通过 doc 构建它在 doc/build
中,但在那之后呢?我在 project/build/
中看到了一些 makefile,我想用 Java 导入这个库。任何帮助将不胜感激,因为我在文档中找不到任何内容,我所知道的是有一些 makefile 和描述声称该库具有其他语言的 native 绑定(bind)。
最佳答案
仔细观察 ./configure
的输出,确保构建已配置为创建 SWIG 组件(即,针对 Java。)
Option summary: Use ccache .................: no Use dependency checking ....: no Use -fPIC...................: yes Use shared dependencies.....: yes Compile type................: Normal Compile examples............: no Compile SQL compiler........: no Compile SWIG bindings.......: no <-------- should say yes With DotNet...............: no With Java.................: no <--------- me too With PERL.................: no With PHP..................: no With Python 2.............: no With Python 3.............: no With Ruby.................: no With Node.js..............: no Enable Maintainer Docs......: no
我试过了,需要一个相当新的 SWIG 版本——比我的包管理器中的版本更新。没有它,SWIG 绑定(bind)就不会构建,也就没有 Java。
但是,一旦您确实获得了该构建,调用jar
文件应该是一项相当简单的工作,就像任何其他 Java 项目一样。谁知道呢,构建甚至可能会为您生成 Javadoc,因此您对调用什么有所了解。
关于java - 如何在 Java 中包含一个在 C++ 中具有 native 绑定(bind)的库(剧本)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42693606/