Hello everyone.
I'm new owner of KT and I wanted to help community to create some more advanced application for Kindle.
I've investigated the topic of loading C/C++ libraries to Java using JNI interface.
Base on this
http://codethesis.com/sites/default/...et=4&content=2 tutorial I was able to create solution that works very reliable and can:
- load system jni libraries - unfortunately this require additional permissions in /opt/amazon/ebook/security/external.policy. In attached example I was able to create jni wrapper for system library /usr/java/lib/libjnifsutil.so
- load libraries from any other directory - like /mnt/us/documents/ etc.
- load library from azw2/jar file - during start of application library is unpacked to cache directory (if isn't there already) and then loaded.
I think the only disadvantage of my solution is that we need to modify policy file and grant special permissions. To run my example application you have to edit
/opt/amazon/ebook/security/external.policy
and add following permissions (first 3 are mandatory, last is only for this specific application)
Code:
grant signedBy "Kindlet" {
permission java.lang.RuntimePermission "loadLibrary.*";
permission java.lang.RuntimePermission "createClassLoader";
permission java.lang.RuntimePermission "getClassLoader";
permission java.util.PropertyPermission "java.library.builtin.jnifsutil", "read";
};
My sample application doesn't do anything useful, so if you aren't developer do not bother installing it. Wait until I start using gathered knowledge to do something productive

(like gui for MPD - with JNI it should be very simple to write).
If you are developer then try it, ask questions in this thread and use source code if you find it useful in your project.
P.S. Sorry for my English.
P.S.2 I suck at Java

so if you find any bugs or opportunities to improvement in this code feel free to criticize me