1 Download the Java JNI version of Ictclas Word pack from the network
Ictclas official website is: http://ictclas.org/
Ictclas2011_linux_32_jni Download address is: Http://ictclas.org/down/50/ICTCLAS50_Windows_32_JNI.rar
2 new Java project, the Class code is:
public class Exec {
public static void Main (string[] args) {
try {
Ictclas. I3s. AC. ICTCLAS50 testICTCLAS50 = new Ictclas. I3s. AC. ICTCLAS50 ();
The path of the library required for participle
String Argu = ".";
Class
if (Testictclas50.ictclas_init (Argu.getbytes ("GB2312")) = = False) {
System.out.println ("Init fail!");
Return
} else {
System.out.println ("Init succeed!");
}
String sinput = "Let's try Java's Jni invocation method today." ";
byte nativebytes[] = testictclas50.ictclas_paragraphprocess (sinput
. GetBytes ("GB2312"), 0, 1);
System.out.println (nativebytes.length);
String nativestr = new String (nativebytes, 0, Nativebytes.length,
"GB2312");
SYSTEM.OUT.PRINTLN ("The result is:" + nativestr);
Testictclas50.ictclas_exit ();
catch (Exception ex) {
}
}
}
3) will compress the source code in the API directory in the package, that is, the ICTCLAS50 in the package Ictclas\i3s\ac to join the project
4) Put all other files in the API directory in the compressed package directly into the current project root directory
Can be run
Enter as:
Init succeed!
68
The result is: we/RR today/t test/V/m/v java/x/ude1 jni/x Call method/N. /wj