- Java code
import ICTCLAS.ICTCLAS50;import java.util.*;import java.io.*; public class Test extends ICTCLAS50{ public static void main(String[] args) { try { Test testICTCLAS50 = new Test(); //分词所需库的路径 String argu = "."; //初始化 if (testICTCLAS50.ICTCLAS_Init(argu.getBytes("GB2312")) == false) { System.out.println("Init Fail!"); return; } else { System.out.println("Init Succeed!"); } String sInput="点击下载超女纪敏佳深受观众喜爱。禽流感爆发在非典之后。"; 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){ } }}
这是中科院分词软件提供的jni接口里的样例代码,我运行的时候报出下面错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: ICTCLAS.ICTCLAS50.ICTCLAS_Init([B)Z
at ICTCLAS.ICTCLAS50.ICTCLAS_Init(Native Method)
at test.Test.main(Test.java:17)
不懂?求助!
------解决方案--------------------
哎。。。这个问题我也碰到过