0

I am stuck at importing a library which is originally written in C++, but has native binding for Java. Here is the library https://github.com/NationalAssociationOfRealtors/libRETS, and I was able to build it through the doc in doc/build, but what after that? I see some makefiles in project/build/ and I want to import this library in Java. Any help will be really appreciated as I cannot find anything in the documentation, all I know is there are some makefiles and the description claims that this library has native bindings for other languages.

psr
  • 2,619
  • 4
  • 32
  • 57
  • You have tu use either JNA or JNI, I think you will find many answer with that keywords, like : http://stackoverflow.com/questions/2241685/java-native-access-doesnt-do-c-right – pdem Mar 09 '17 at 11:05
  • If you look at the examples here http://www.dis.com/NAR/libRETS_Dev_Guide.html#connecting-session, I think it's being imported as a jar directly. Is there a way to make a jar out of this project? – psr Mar 09 '17 at 11:11

1 Answers1

1

Watch the output of ./configure carefully and make sure the build is configured to create the SWIG components (namely, for 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

I tried it and a fairly recent version of SWIG was required -- more recent than were in my package manager. Without that, the SWIG bindings don't get built and there's no Java.

However, once you do get that build, it should be a fairly straightforward endeavor of calling into a jar file, as with any other Java project. Who knows, the build might even generate Javadoc for you so you have some idea of what to call.

Jameson
  • 6,400
  • 6
  • 32
  • 53