A.I. Wiki

Interested in AI? Get tips & stories in your inbox:

NativeJARs: Bundling C and C++ code in a JAR file

Just like WebJars took popular client-side Javascript libraries like JQuery and packaged them in JAR files to be used in Java projects, NativeJARs does the same for popular scientific computing libraries like Cpython or the native components of TensorFlow.

NativeJars bundles those libraries so that they can be easily imported into Java projects. Sure, you could take those same libraries, zip them up and put them in a JAR file yourself. Or you could just put it in Docker. But sometimes you need native libraries in a JAR file, and NativeJARs makes that easy.

Once those libraries are packaged in the JAR, NativeJARs lets you call native functions from Java. For example, let’s say there’s an evaluation function for machine learning that someone wrote in TensorFlow. Well, you don’t have to reimplement it now, you can just call it. Need a beam-search implementation that’s only available in C++? Just call it.

NativeJARs is the bridge between native code and Maven, which acts as the package manager. NativeJARs relies on JavaCPP. More information about JavaCPP is available here.

LEARN MORE »

Interactive Demo

Learn to build AI applications using our interactive learning portal.

TRY IT NOW