1 |
tim |
1.1 |
/* |
2 |
|
|
* Demo the use of JNI in Ant |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
public class JniDemo { |
6 |
|
|
|
7 |
|
|
static { |
8 |
|
|
System.loadLibrary("JniDemo"); |
9 |
|
|
} |
10 |
|
|
|
11 |
|
|
public native int getCount(); |
12 |
|
|
public native void setCount(int count); |
13 |
|
|
|
14 |
|
|
public static void main(String[] args) { |
15 |
|
|
JniDemo demo = new JniDemo(); |
16 |
|
|
int count = demo.getCount(); |
17 |
|
|
System.out.println("Count starts at "+count); |
18 |
|
|
demo.setCount(4); |
19 |
|
|
System.out.println("Count set to 4"); |
20 |
|
|
count = demo.getCount(); |
21 |
|
|
System.out.println("Count is actually "+count); |
22 |
|
|
} |
23 |
|
|
} |