I got the following message: 'Error loading JNI-InChI native code', what does it mean?

The program you are using is making use of the JNI-InChI library. The JNI-InChI library provides a wrapper to the InChI software produced by IUPAC, enabling its use from within java. Unlike java programs the InChI software is not platform independent. JNI-InChI includes versions of the InChI code for a number of common operating systems and architectures, but if you received the above error you probably need to compile the code for your system. For instructions, see the next question.

How do I compile JNI-InChI's native code for my operating system/architecture?

JNI-InChI's native code compilation is integrated into the Apache Maven build process. To compile the code you need to get the source package from the download page, or check the project out of the subversion repository.

In order to build JNI-InChI the following software is required:

  • Java (JDK) 1.5 or higher
  • Apache Maven 2.0
  • GNU Make
  • GCC

The JAVA_HOME environment variable MUST be set, pointing to the location of the JDK.

The Maven build system takes care of JNI-InChI's dependencies, and runs Make to build the native code required. From JNI-InChI's root directory (containing the file pom.xml) simply run Maven with the desired goal:

To install JNI-InChI in you local Maven repository:

mvn install

To compile JNI-InChI, and create a JAR file:

mvn package

[ This will create a JAR file: target/jniinchi-(version).jar ]

To compile JNI-InChI, and create a JAR file including dependencies:

mvn assembly:single

[ This will create a JAR file: target/jniinchi-(version)-jar-with-dependencies.jar ]

All these commands will compile the Java code, call Make to build the C code and run a suite of unit tests to ensure the code has compiled successfully.

If you have previously tried using JNI-InChI, then you may need to clear cached old versions of the native code from your system. To do this, delete the contents of the ~/.jnati/repo/jni-inchi directory.

What is this .jnati directory that has appeared in my home directory?

When JNI-InChI is run the native code must also be loaded. JNI-InChI uses a library called jnati to select the correct native library for your system. If the necessary files cannot be located, jnati checks to see whether they are bundled inside a JAR file, or downloads them from a remote repository. If so, these files are then cached in the .jnati directory, so they can be reused next time JNI-InChI is run.

My question wasn't answered, what should I do?

Contact the JNI-InChI mailing list.