Skip to content

Deployment

at055612 edited this page May 20, 2026 · 1 revision

Native Libraries

LmdbJava depends upon two native libraries to function: LMDB and jffi. Both need to be present for LmdbJava to work. Both LmdbJava and its jffi dependency come bundled with a selection of native libraries complied for specific platforms. Alternatively both native libraries can be pre-installed and made available for LmdbJava/jffi to use.

WARNING:
Both the LMDB and jffi native libraries will fail to run if their location has been mounted with the noexec mount option. noexec is often set on /tmp mounts, which is the default extraction location. If /tmp is mounted with noexec you will either need to remove that option, with the security implications that that brings, or configure alternative extraction locations (see below).

The following sub-sections are only needed if any of these is true:

  • /tmp has been mounted with noexec.
  • You are not using typical hardware so need to provide your own native libraries.
  • Security considerations dictate that you provide your own native libraries.
  • You want to use a more recent version of LMDB, while understanding the risk of incompatibilities.

LMDB Native Library

Default Behaviour

If you do nothing, by default LmdbJava will extract an LMDB native library from its JAR (appropriate to the platform) into a temporary file prefixed with lmdbjava-native-library-. See lmdbjava/native for more details. This extracted native library file will be deleted on system exit.

Custom Extraction Location

To specify a different extraction location, set the system property lmdbjava.extract.dir to a suitable extraction directory that must already exist. Ensure this directory has not been mounted with noexec.

Provided Library

It is possible to use a pre-installed LMDB native library, e.g. if the bundled libraries are not compatible with your platform architecture. Care needs to be taken however, to ensure that the version of the LMDB native library is compatible with the version of LmdbJava in use.

To use a provided library, set the system property lmdbjava.native.lib to the location of the native LMDB library. If LMDB has been installed in standard system paths, e.g. by a package manage, then use the value lmdb.

Source

The source code responsible for extracting/loading the library can be found in:

Library.java
TargetName.java

jffi Native Library

LmdbJava has a dependency on jffi. This also comes bundled with native libraries for different platforms.

Default Behaviour

If you do nothing, jffi will extract an appropriate native library to temporary file prefixed with jffi. This extracted native library file will be deleted on system exit.

Custom Extraction Location

To specify a different extraction location, set the system property jffi.extract.dir to a suitable extraction directory that must already exist. Ensure this directory has not been mounted with noexec.

Provided Library

To use a pre-installed native library, set the system property jffi.boot.library.path to the location of the native library.

Clone this wiki locally