The Java version of the OpenEye Toolkits is a JNI (Java Native Interface) wrapper created using SWIG. It is important to note that this is not a new version of the toolkits written in Java nor is it a Java interpretation of the toolkit API, but a rather faithful reproduction of the toolkit API in Java. As such there are some features that might not be as Java-like as a toolkit written entirely in Java, but most of these are minor issues and consistency with all the supported languages makes translation from one to another relatively easy and greatly enhances our ability to support all three versions.

A few of these idiomatic differences include:

  • There are relatively few classes in OEChem and they have a rather shallow inheritance hierarchy.

  • Most OEChem algorithms are in C++ free functions. These are mapped to static methods in the class oechem.

  • Method names in most OEChem TK classes start with uppercase letters.

  • Java doesn’t support operator overloading, so C++ operators are mapped to methods. For example, operator bool() is mapped to a member function called IsValid(), operator() is mapped to call() and operator() const is mapped to constCall().

  • Java doesn’t support direct access to class attributes, so for some simple C++ classes and structs, direct access is mapped to a get/set pair of functions.

  • Calling close() is required for all objects that provide a close() method.

  • delete() should be explicitly called on all objects that come from the following toolkits:

    • Grid TK

    • Shape TK

    • Szybki TK

    • Zap TK

    The user should interact with these particular libraries from only a single Java thread. Failing to do so can lead to subtle race conditions.

  • There is a known bug concerning OpenEye constants that occurs when compiling against an older version of the OpenEye jar and running against a newer version of the OpenEye jar. Please make sure to run against java programs against the same version it was compiled with.

A Java version of the toolkits allows integration into Java desktop and server-side applications. However, the Java toolkits are not necessarily suited for applet programming since they require native code and platform- specific shared libraries. This can be achieved by building a multi-platform JAR as described in the final section, but this is considered for experts only.


In general, due to the wrapping of native code, using explicit obj.delete() calls on class instances obtained from any toolkit is highly recommended as it minimizes issues with early or delayed deletion activity by the Java garbage collector on OpenEye class instances.


In order to use the OpenEye Java toolkits, a compatible version the Java SDK must be installed. For the most part, this means installing a version of OpenJDK8 or OpenJDK11 for your platform.

Linux installation also requires the zlib and libcairo libraries be available. These are usually available on Desktop Linux installations by default, but may not be available on Linux server installations.



Support for OpenJDK8 and OpenJDK11 is available for the following platforms:

  • Ubuntu 18.04 LTS x64

  • Ubuntu 20.04 LTS x64

  • RHEL 7 x64

  • RHEL 8 x64


The following platforms are supported with one single build macOS package:

  • macOS 10.15, Java 8 x64 and Java 11

  • macOS 11, Java 8 x64 and Java 11

GPU Prerequisites


A license file from OpenEye Scientific Software is required to run any OpenEye toolkit. A license file can be requested/obtained by contacting OpenEye at

At startup, the toolkit looks for a valid license in the following default locations:

  • In a file specified by the environment variable OE_LICENSE.

  • In a file named oe_license.txt in the directory specified by the environment variable OE_DIR.

  • In a file named oe_license.txt in the user’s platform-specific local OpenEye application data directory. The location of this directory is detailed below:

    • Linux/UNIX:


    • macOS:


    • Microsoft Windows:


  • In a file named oe_license.txt in the current working directory

  • License failure results in fatal error. The examples in OEChemIsLicensed show how to check if a valid license is available.

Download the OpenEye Java distribution

Picking a distribution is relatively easy. For each platform (Windows, Linux, and macOS), we only have 1 download, a 64-bit version (x64).

Download from


Untar or unzip the distribution into a directory of your choice. This will create the following structure:



For Windows, the distribution should be unzipped to a directory with a short pathname, so the longest directory pathname in the tree can be specified in less than 260 characters. Otherwise, one may see errors when running the mentioned below due to the 260 character maximum path limit in Windows.

All the examples are found in the examples directory. Use ant to compile the examples jar then you can run an OEChem example using:

For Linux/macOS:

cd OpenEye-Java-|pkgversion|-OSName-xArch/examples
java -cp ../lib/oejava-|pkgversion|-Linux-x64.jar:openeye.examples.jar openeye.examples.oechem.OEChemInfo

For Windows, note the use of semi-colon instead of a colon in the class path argument:

cd OpenEye-Java-|pkgversion|-OSName-xArch/examples
java -cp ../lib/oejava-|pkgversion|-Windows-x64.jar;openeye.examples.jar openeye.examples.oechem.OEChemInfo

The script can also be run to ensure a properly working distribution in the current environment. If there are problems with the distribution or environment the script will fail. To run

cd OpenEye-Java-|pkgversion|-OSName-xArch/verify


If an error similar to java.lang.OutOfMemoryError: Java heap space occurs, one can increase the heap size of the JVM using the ‘JAVAFLAGS’ environment variable. The ‘-Xmx’ option controls the size of Java heap used. For example, add export JAVAFLAGS=-Xmx4G in bash, and then rerun