Java bindings for pmemkv, using Java Native Interface. Currently functionally equal to pmemkv in version 1.0. Some of the new functionalities (from pmemkv 1.1+) are not available yet.
All known issues and limitations are logged as GitHub issues or are described in pmemkv's man pages.
Java API is documented with javadocs and can be found as html here:
- pmemkv - native key/value library
- Java 8 or higher
- Apache Maven - build system
- Used only for development & testing:
- JUnit - automated test framework
- Oleaster Matcher - test condition matching library
Start by installing pmemkv (currently at least in version 1.0.2) in your system.
It may be necessary to configure a proxy
and set JAVA_HOME
environment variable:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Clone the pmemkv-java tree:
git clone https://github.com/pmem/pmemkv-java.git
cd pmemkv-java
Build and install Java Native Interface (JNI) and java bindings:
mvn install
If dependencies (pmemkv, libpmemobj-cpp, pmdk, etc.) are installed in non-standard location it may be also necessary to set it in LD_LIBRARY_PATH, e.g.:
LD_LIBRARY_PATH=path_to_your_libs mvn install
This library includes a set of automated tests that exercise all functionality.
LD_LIBRARY_PATH=path_to_your_libs mvn test
We are using /dev/shm
to
emulate persistent memory
in examples.
Examples can be found within this repository in examples directory. To execute them, run e.g.:
cd examples
javac -cp ../src/main/target/*.jar StringExample.java
PMEM_IS_PMEM_FORCE=1 java -ea -Xms1G -cp .:`find ../src/main/target -name *.jar` -Djava.library.path=../src/main/cpp/target StringExample
Docs can be generated using mvn by executing commands:
mvn javadoc:javadoc