← Back to Index

Voikko
Using in Java applications

The Java interface for Libvoikko is available on the Maven Central Repository:

<dependency>
    <groupId>org.puimula.voikko</groupId>
    <artifactId>libvoikko</artifactId>
    <version>4.1.1</version>
</dependency>

In addition to this artifact you need to have the native libvoikko library and at least one dictionary installed in order to use Voikko in your application.

Installing the native library

... or how to resolve Could not load the native component of libvoikko.

You need to have the native libvoikko library available in a place where the OS specific library loading mechanism (System.loadLibrary in fact) will find it. Most modern Linux distributions contain the libvoikko package; installing that should be sufficient. On Windows you should place libvoikko-1.dll in one of the directories within the PATH environment variable. Here you can download the library for Windows (choose 32 or 64 bit version according to your Java VM).

Versions of the Java interface and the native library do not need to be exactly the same. The requirements are listed in the following table:

Java interface (Maven artifact) versionRequired native library version
4.1.13.8 or later
4.0.13.8 or later
3.6.13.1 or later

Installing suitable dictionary files

... or how to resolve org.puimula.libvoikko.VoikkoException: Specified dictionary variant was not found

You need to have a dictionary installed that is compatible with your version of libvoikko and matches the language (and language variant) you specified as a parameter in the constructor for Voikko object. Here you can download various dictionary packages for Finnish. The dictionary packages need to be unzipped but the directory structure within the packages must be preserved.

On Linux you can unpack the dictionaries under /etc/voikko or $HOME/.voikko. On Windows these default locations must be set through the system registry. Another, more portable option is to choose an application specific installation directory for the dictionaries and use the two parameter constructor of Voikko to specify that directory.