2) create a Java project with the class code:
Public class Exec {
Public static void main (String [] args ){
Try {
ICTCLAS. I3S. AC. ICTCLAS50 testICTCLAS50 = new ICTCLAS. I3S. AC. ICTCLAS50 ();
// Path of the library required for word splitting
String argu = ".";
// Initialization
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 call 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 ){
}
}
} Www.2cto.com
3) Add the source code in the API directory of the compressed package, that is, the ICTCLAS50 in the ictclas \ I3S \ AC package to the project.
4) put all the other files in the API directory of the compressed package directly to the root directory of the current project.
To run
Input:
Init Succeed!
68
The result is: We/rr today/t try/v/m try/v Java/x/ude1 JNI/x call method/n. /Wj