There are two different solutions available for using Voikko ja Java applications.
Raudikko is a partial reimplementation of libvoikko written in pure Java. It does not have all the features of libvoikko but if you only need to do morphological analysis or search indexing for Finnish this is definitely the easiest and recommended solution. Raudikko uses Voikko's morphological dictionaries (version 5, Finnish VFST) so it will give you exactly the same results as original libvoikko but without the significant additional work needed to install and use native C++ libraries.
There is also an Elasticsearch plugin providing Finnish analysis built on top of Raudikko.
Libvoikko comes with Java wrapper that uses native libvoikko over JNA interface. This option gives you all the features of libvoikko including spelling and grammar checker but you will have to install the native libraries. Use this only if Raudikko is not enough for your purposes.
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.
... 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) version | Required native library version |
---|---|
4.1.1 | 3.8 or later |
4.0.1 | 3.8 or later |
3.6.1 | 3.1 or later |
... 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.