ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/JniDemo.java
Revision: 1.3
Committed: Tue Sep 18 12:55:32 2007 UTC (16 years, 8 months ago) by jsr166
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
State: FILE REMOVED
Log Message:
Unused demo programs.

File Contents

# Content
1 /*
2 * Demo the use of JNI in Ant
3 */
4 import java.util.*;
5
6 public class JniDemo {
7
8 static {
9 System.loadLibrary("JniDemo");
10 }
11
12 public native int getCount();
13 public native void setCount(int count);
14
15 public static void main(String[] args) {
16 Map<String, Integer> m = new HashMap<String, Integer>();
17 for (String s : args) {
18 if (!m.containsKey(s)) m.put(s, 0);
19 m.put(s, m.get(s)+1);
20 }
21 for (String s : m.keySet()) {
22 System.out.println(""+m.get(s)+" "+s);
23 }
24
25 JniDemo demo = new JniDemo();
26 int count = demo.getCount();
27 System.out.println("Count starts at "+count);
28 demo.setCount(4);
29 System.out.println("Count set to 4");
30 count = demo.getCount();
31 System.out.println("Count is actually "+count);
32 }
33 }