ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/JniDemo.java
Revision: 1.1
Committed: Sat Dec 13 20:45:42 2003 UTC (20 years, 6 months ago) by tim
Branch: MAIN
Log Message:
Add C++/JNI demo targets as first step to possible use of JNI in
1.4-usable version of j.u.c. Still probably highly Windows-specific,
but at least it uses gcc, so there is hope.

File Contents

# Content
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 }