package com.hui;
import com.hui.*;
public class MainWindow {
public static void main(String[] args) {
TestJNI t = new TestJNI();
t.isInLibrary();
t.addData("01958", 100);
System.out.println("存儲的條形碼爲:"+t.getDataBar());
System.out.println("存儲的數據爲:"+t.getNum());
}
}
MainWindow.java
package com.hui;
public class TestJNI {
public native void isInLibrary();
public native boolean addData(String strDataBar,int nNum);
public native int getNum();
public native String getDataBar();
static {
System.loadLibrary("CallMyLibrary");
}
}
TestJNI.java