PathEngine home previous: Java Native Interfacenext: Naming Conventions
Contents, Programmers Guide, Using PathEngine with Other Languages, Java Native Interface, Building with JNI

Building with JNI

The JNI mapping for PathEngine is built into a special version of the run-time library, and this page explains how to build this run-time library version.

Platform support

At the time of writing, the JNI mapping has been tested on Linux platforms, and project configuration is supplied for these platforms, with the python build scripts. (If you need JNI support on Windows let us know, and it should be straightforward to add this.)


You'll need the Java SE installed ('Java Platform, Standard Edition'), which will usually come in the form of either the OpenJDK or Oracles JDK implementation. Many Linux distributions will come with this already installed, but you'll need to find out which JDK is active (if multiple JDK versions are installed), and the location of the JDK c++ headers.

Project target

You'll need to build the 'PathEngine_JNI' shared object project, with the root project source file located at 'SDKRoot/code/project/so/PathEngine_JNI.cpp'. This is a standard PathEngine project, and you can build this project with the instructions on this page: Building with the Python Build Scripts, after modifying the python scripts slightly to add the paths to include headers for JNI in your java SDK.

Locating JNI include directories

One way to locate your JNI include directories is to find what typing 'java' executes, and following symbolic links, e.g. with 'readlink -f $(which java)'. This should return something like '/usr/lib/jvm/jdk1.7.0_25/bin/java', and in this case the JNI includes can be found in '/usr/lib/jvm/jdk1.7.0_25/bin/java/include'.

Adding JNI include directories to the PathEngine include scripts

You'll need to add the JNI include directories to the PathEngine include scripts in order for the PathEngine_JNI project to build. Open 'SDKRoot/python/buildScripts/' and look for commented lines showing how to do this. Note that two additional include directories are required if you are using the Oracle JDK (the include directory itself, plus a 'Linux' subdirectory), whereas just one additional include directory is required with OpenJDK.

After adding the JNI include directories, and running the python build scripts you should end up with the target file in something like 'SDKRoot/build/GCCx64/Debug/so/' (for the 'GCCx64' build platform and debug configuration).

Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: Naming Conventions