I am trying to make something new in my project ...
I found some resources called: ICTCLAS(Institute of Computing Technology, Chinese Lexical Analysis System)
so I am going to integrated into our KM system, adding DOCUMENT RELEVANCY feature.
In fact, ICTCLAS provides a API as DLL, so I need to use JAVA JNI to use the DLL...
then I found Jawin on Google~~~
---------------------------------------------------
OK, very simple sample code:
/*
* HelloDll.java -
*
* This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
*
* Please consult the LICENSE file in the project root directory,
* or at the project site before using this software.
*/
/* $Id: HelloDll.java,v 1.2 2004/01/04 12:00:27 arosii_moa Exp $ */
package demos;
import org.jawin.FuncPtr;
import org.jawin.ReturnFlags;
/**
* Demo that uses the Win32 MessageBoxW API-method.
*
* @version $Revision: 1.2 $
* @author Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
*/
public class HelloDll {
public static void main(String[] args) {
try {
FuncPtr msgBox = new FuncPtr("USER32.DLL", "MessageBoxW");
msgBox.invoke(0, "Hello From a DLL", "From Jawin", 0, ReturnFlags.FAIL_ON_FALSE);
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------------------------
for the first time , it's not work and the the console said:
java.lang.UnsatisfiedLinkError: no jawin in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at org.jawin.Bootstrap.<clinit>(Bootstrap.java:33)
at org.jawin.FuncPtr.<init>(FuncPtr.java:28)
at dominojava.DominoJava.main(DominoJava.java:35)
Exception in thread "main"
so I checked its doc. Yes, I need to set the standard java.library.path property first.
wait, more simple way, just put jawin.dll file into System32 directory is ok.... because System32 is the default location of java.library.path.
Jawin package! hope u work!
最新推荐文章于 2022-08-20 21:38:36 发布