Index: examples/example_scripts/java/Makefile
===================================================================
--- examples/example_scripts/java/Makefile	(revision e3c7769053dca8eafe102086cebf103cea51504d)
+++ examples/example_scripts/java/Makefile	(revision ced90bcaccd49c37147267428a462724244407b3)
@@ -1,5 +1,5 @@
 
-.PHONY : tt tchunk
-all: run_attr run_prove
+.PHONY : tt tchunk run_threaded
+all: run_attr run_prove run_threaded
 
 clean:
@@ -20,4 +20,9 @@
 	./run_prover 1 >prover.log 2>& 1
 
+run_threaded:
+	rm -rf threaded.log
+	make run_attr
+	./run_thread 1 >threaded.log 2>& 1
+
 tchunk:
 	make clean
Index: examples/example_scripts/java/build.xml
===================================================================
--- examples/example_scripts/java/build.xml	(revision e3c7769053dca8eafe102086cebf103cea51504d)
+++ examples/example_scripts/java/build.xml	(revision ced90bcaccd49c37147267428a462724244407b3)
@@ -33,5 +33,5 @@
     <mkdir dir="${classes.dir}" />
     <javac srcdir="${src.dir}" destdir="${classes.dir}" 
-      classpathref="compile.classpath" includeAntRuntime="no" excludes="**/prover_test.java **/abac_attr.java **/ProverTest.java **/SetupTest.java"/>
+      classpathref="compile.classpath" includeAntRuntime="no" excludes="**/prover_test.java **/abac_attr.java **/threaded_test.java"/>
   </target>
 
@@ -39,5 +39,5 @@
     <mkdir dir="${jar.dir}"/>
     <jar destfile="${jar.dir}/jabac-${version}.jar" basedir="${classes.dir}"
-      excludes="**/prover_test.class **/abac_attr.class">
+      excludes="**/prover_test.class **/abac_attr.class **/threaded_test.class">
       <manifest>
 	<attribute name="Class-Path" value="${classpath}" />
Index: examples/example_scripts/java/run_thread
===================================================================
--- examples/example_scripts/java/run_thread	(revision ced90bcaccd49c37147267428a462724244407b3)
+++ examples/example_scripts/java/run_thread	(revision ced90bcaccd49c37147267428a462724244407b3)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+rm -rf hs_*.log
+
+keystore=`pwd`
+
+javac -classpath ${keystore}/build/classes threaded_test.java
+
+java -classpath ${keystore}/build/classes:. -Djava.library.path=/usr/local/lib threaded_test ${keystore} IceCream delicious Chocolate
Index: examples/example_scripts/java/threaded_test.java
===================================================================
--- examples/example_scripts/java/threaded_test.java	(revision ced90bcaccd49c37147267428a462724244407b3)
+++ examples/example_scripts/java/threaded_test.java	(revision ced90bcaccd49c37147267428a462724244407b3)
@@ -0,0 +1,88 @@
+import java.io.*;
+import java.util.*;
+
+
+import net.deterlab.abac.*;
+
+/**
+ * Test swig generated JNI for libabac in threaded condition.
+ * Multiple threads, each loads credentials from keystore and 
+ * runs a query against them.
+ */
+
+public class threaded_test implements Runnable {
+   static String keystore;
+   static String iname;
+   static String roletype;
+   static String pname;
+
+    static {
+        System.loadLibrary("jABAC");
+    }
+
+    public void run(String[] args) {
+        System.out.println("Hello from a thread!");
+
+        String _keystore=args[0];
+        String _iname=args[1];
+        String _roletype=args[2];
+        String _pname=args[3];
+
+        Context ctxt = new Context();
+
+/*
+role="[keyid:${pID}].role:delicious"
+principal="[keyid:${cID}]"
+*/
+        String ifname=iname+"_ID.pem";
+        String pfname=pname+"_ID.pem";
+
+        ID iID=new ID(ifname);
+        ID pID=new ID(pfname);
+
+        String ikeyid=iID.id_keyid();
+        String pkeyid=pID.id_keyid();
+
+        String role="[keyid:"+ikeyid+"].role:"+roletype;
+        String principal="[keyid:"+pkeyid+"]";
+
+        ctxt.load_directory(keystore);
+
+        /* what is in prolog db 
+        ctxt.dump_yap_db(); */
+
+        AttributeVector credentials = ctxt.query(role, principal);
+
+        long sz=credentials.size();
+ 
+        if(sz > 0)
+            System.out.println("prover success!!");
+        else
+            System.out.println("prover failed!!");
+
+        for(int i=0; i<sz; i++) {
+            Attribute c=credentials.get(i);
+            System.out.println(c.head_string()+"<- "+c.tail_string());
+        }
+
+        ctxt.free_context_now();
+        System.out.println("done, run from thread_test.java");
+    }
+
+    public static void main(String[] args) throws IOException {
+
+        if (args.length != 4) {
+            System.out.println("Usage: prover_test <keystore> <issuer> <roletype> <principal>");
+            System.out.println("    runs the query issuer.role <-?- principal and prints the result"
+);
+            System.exit(1);
+        }
+
+        keystore=args[0];
+        iname=args[1];
+        roletype=args[2];
+        pname=args[3];
+
+        (new Thread(new threaded_test(args))).start();
+    }
+}
