-
Notifications
You must be signed in to change notification settings - Fork 24
java install
Java interface has been part of libvoikko since version 3.2. This is how you can use it.
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. On Linux installation through the package manager will work (on Ubuntu 10.10 installing Finnish language support is enough). On Windows you should place the library in one of the directories within the PATH environment variable.
Dictionaries (voikko-fi or any zhfst speller) should be installed just as with any other application that uses Voikko.
Shipping the native library and dictionaries within one jar package is possible but requires some development effort. The main problem is that these files cannot be used directly from the jar package, they need to be extracted from it before use. JNA already does that for the libraries if it cannot find them using other means but similar trick would need to be developed for dictionaries.
- Install Eclipse.
- From Git:
- Within Eclipse select File - New - Project and Checkout projects from Git.
- Follow the wizard to check out https://github.com/voikko/corevoikko and find the project under libvoikko/java . The wizard should suggest libvoikko as the project name, accept that.
- From source package:
- Import the project under subdirectory java.
- Libvoikko depends on JNA libraries for its operation. Eclipse will use Maven to download and install such dependencies automatically. Check that you don't have any compilation errors in the project.
- Open your own development project or create one through File - New - Project.
- Edit your project's Java build path and add libvoikko as a required project to the build path.
Now you should be able to use libvoikko in your Java project. See the libvoikko Javadoc documentation for more info and a simple example.
If you do not want to use Maven or Git you can download
- binary and source jars and documentation for libvoikko from http://www.puimula.org/htp/testing/voikko-sdk/java/
- binary and source jars and documentation for JNA from https://jna.dev.java.net/
- standard libvoikko source package, version 3.2 or later.
Just make sure that the binary jars for libvoikko and JNA are in your classpath when you run or develop your application.
See Javadoc documentation at http://www.puimula.org/htp/testing/voikko-sdk/java/javadoc/
You can run the unit tests for the Java interface in order to verify that you have all the required stuff installed and working as expected. On Linux, using JUnit and JNA from the distribution:
java -cp libvoikko-3.2-SNAPSHOT.jar:libvoikko-3.2-SNAPSHOT-tests.jar:/usr/share/java/junit4.jar:/usr/share/java/jna.jar org.junit.runner.JUnitCore org.puimula.libvoikko.VoikkoTest org.puimula.libvoikko.VoikkoJnaLatinTest
On Windows, using JUnit and JNA downloaded from the projects' home pages:
java -cp libvoikko-3.2-SNAPSHOT.jar;libvoikko-3.2-SNAPSHOT-tests.jar;junit4.jar;jna.jar org.junit.runner.JUnitCore org.puimula.libvoikko.VoikkoTest org.puimula.libvoikko.VoikkoJnaLatinTest