How to Load Native JNI Library from JAR

The JNI (Java Native Interface) is a framework that provides a bridge between Java and native applications. Java applications can define native methods which are implemented in dynamic library written in other languages such as C or C++. The dynamic library is able to call both static and dynamic methods. More information about JNI can be found on Wiki or in tutorial Beginning JNI with NetBeans (for Linux).

The problem is that for loading such a dynamic library you have to call method System.load(String filename) which requires an absolute filename. This approach is just fine if you have dynamic library outside the application’s JAR archive, but when bundling dynamic library within the JAR it is necessary to extract the library into filesystem before loading it. And that’s exactly what my code does.

Continue reading

Decimal Comma in Matlab Plots

A lot of languages (not only the European ones) use decimal comma instead decimal point to separate the whole and the fractional part of a number in decimal form. Matlab (like other programs) uses decimal point for this purpose. This is okay when using it for computations but it is better to use decimal comma in graphs embedded in documents written in some European language.

This approach also works in GNU Octave which is available for free. ;-)

Continue reading