Elektra
0.8.18
|
Allows you to write plugins in java.
Needs Java 8 or later. While the plugin internally uses JNI, the Java binding for your java-plugin may use something different, e.g. JNA. The requirements for the java bindings are:
The java plugin itself needs to have the following methods:
Please install java8 as package, e.g. for debian and then let cmake actually find jdk8:
cd /usr/lib/jvm/ && sudo rm -f default-java && sudo ln -s java-8-oracle default-java
and for the runtime, create the file /etc/ld.so.conf.d/java-8-oracle.conf
with the content (for amd64):
/usr/lib/jvm/default-java/jre/lib/amd64 /usr/lib/jvm/default-java/lib/amd64 /usr/lib/jvm/default-java/jre/lib/amd64/server
and run:
sudo ldconfig
Then enable the plugin using:
cmake -DPLUGINS="...;jni" /path/to/libelektra
Running
kdb-full
should work then, if you get one of these:
kdb-full: error while loading shared libraries: libmawt.so: cannot open shared object file: No such file or directory kdb-full: error while loading shared libraries: libjawt.so: cannot open shared object file: No such file or directory
You missed one of the ldconfig steps.
You need to pass :
Additionally, you can set:
E.g.
kdb info -c classname=elektra/plugin/PropertiesStorage,classpath=.:/usr/share/java/jna.jar:/usr/lib/java:/path/to/libelektra/src/bindings/jna,print= jni kdb check -c classname=elektra/plugin/PropertiesStorage,classpath=.:/usr/share/java/jna.jar:/usr/lib/java:/path/to/libelektra/src/bindings/jna,print= jni kdb mount -c classname=elektra/plugin/PropertiesStorage,classpath=.:/usr/share/java/jna.jar:/usr/lib/java:/path/to/src/bindings/jna,print= file.properties /jni jni classname=elektra/plugin/PropertiesStorage,classpath=.:/usr/share/java/jna.jar:/usr/lib/java:/path/to/libelektra/src/bindings/jna,print=
Or if .jar is already installed:
bin/kdb mount -c classname=elektra/plugin/PropertiesStorage,classpath=.:/usr/share/java/jna.jar:/usr/share/java/elektra.jar,print= file.properties /jni jni classname=elektra/plugin/PropertiesStorage,classpath=.:/usr/share/java/jna.jar:/usr/share/java/elektra.jar,print=
Additionally, the java implementation can request any other additional configuration, read about it below in the section (specific java plugin). If you are reading this page on github, you won't see it, because the plugins dynamically append text after the end of this page.
To know how the methods of your class are called, use:
javap -s YourClass
Also explained here
(Argumentation for -500 in status)