Index: examples/example_scripts/java/Makefile
===================================================================
--- examples/example_scripts/java/Makefile	(revision 0cc535ebd0dcf65a8892a4db4207fdb6d1b91eb0)
+++ examples/example_scripts/java/Makefile	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -6,4 +6,5 @@
 	@rm -f *.pem *.der *.log pfile 
 	@rm -rf build *.class tt rr
+	@rm -rf lib; mkdir lib
 
 
Index: examples/example_scripts/java/abac_attr.java
===================================================================
--- examples/example_scripts/java/abac_attr.java	(revision 0cc535ebd0dcf65a8892a4db4207fdb6d1b91eb0)
+++ examples/example_scripts/java/abac_attr.java	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -39,7 +39,7 @@
         chocoID.id_write_cert("Chocolate_ID.pem");
         chocoID.id_write_privkey("Chocolate_private.pem");
-        ctxt.load_id(chocoID);
 
-        ctxt.load_id_chunks(iceID.id_cert_chunk(), iceID.id_privkey_chunk());
+        /* ctxt.load_id(chocoID); */
+        /* ctxt.load_id_chunks(iceID.id_cert_chunk(), iceID.id_privkey_chunk()); */
         /*or,  ctxt.load_id(iceID); */
 
@@ -56,6 +56,10 @@
         attr.attribute_write_cert("IceCream_attr.der");
 
+        ctxt.load_id(chocoID);
+        ctxt.load_id_chunks(iceID.id_cert_chunk(), iceID.id_privkey_chunk());
+        ctxt.load_attribute(attr); 
+
         /* load attribute cert into the context */
-        ctxt.load_attribute_chunk(attr.cert_chunk());
+        /* bad--ctxt.load_attribute_chunk(attr.cert_chunk()); */
         /* or, ctxt.load_attribute(attr); */
 
Index: examples/example_scripts/java/bad_prover.c
===================================================================
--- examples/example_scripts/java/bad_prover.c	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
+++ examples/example_scripts/java/bad_prover.c	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -0,0 +1,118 @@
+/**
+   prover.c
+
+gcc -g -o prover bad_prover.c -L/usr/local/lib -L/usr/local/lib/ipsec -labac -lYap -lreadline -lm -lstrongswan -lpthread -Wl,-rpath -Wl,/usr/local/lib/ipsec
+
+**/
+
+#include <err.h>
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+
+#include <abac.h>
+
+extern abac_credential_t **abac_context_query_with_structure(abac_context_t *ctx, abac_aspect_t *queryfor, abac_aspect_t *with, int *success);
+extern char *abac_id_keyid(abac_id_t *id);
+extern abac_aspect_t *abac_aspect_new(int type, char *principal_name, char *aspect_name);
+extern char *abac_aspect_string_with_condition(abac_aspect_t *);
+extern int abac_attribute_create(abac_attribute_t **ret, abac_aspect_t *head, abac_aspect_t *tail, int validity);
+extern char *abac_aspect_typed_string_with_condition(abac_aspect_t *);
+extern abac_id_t *abac_aspect_get_issuer_id(abac_aspect_t *ptr);
+extern abac_aspect_t *abac_role_principal_create(char *principal_name);
+extern void abac_print_cred_info(abac_credential_t*, FILE*);
+extern void abac_print_prin_info(abac_id_credential_t*, FILE*);
+
+
+void print_all(abac_context_t *ctx, char *msg)
+{
+    abac_credential_t *cred=NULL;
+    abac_credential_t **credentials=NULL;
+    abac_id_credential_t *prin=NULL;
+    abac_id_credential_t **principals=NULL;
+    int i;
+
+fprintf(stderr,"\n===>>>%s\n",msg);
+        credentials = abac_context_credentials(ctx);
+        if (credentials != NULL) {
+            for (i = 0; credentials[i] != NULL; ++i) {
+                cred = credentials[i];
+                abac_print_cred_info(cred,stderr);
+            }
+            abac_context_credentials_free(credentials);
+        }
+
+        principals = abac_context_principals(ctx);
+        if (principals != NULL) {
+            for (i = 0; principals[i] != NULL; ++i) {
+                prin = principals[i];
+                abac_print_prin_info(prin,stderr);
+            }
+            abac_context_principals_free(principals);
+        }
+fprintf(stderr,"<<<===%s\n\n",msg);
+}
+
+
+int main(int argc, char **argv)
+{
+    abac_context_t *ctx = abac_context_new();
+
+    abac_id_t *ice=NULL;
+    abac_id_generate(&ice, "IceCream", 0);
+    abac_id_t *choco=NULL;
+    abac_id_generate(&choco,"Chocolate", 0);
+
+/*
+    abac_context_load_id_id(ctx,ice);
+    abac_context_load_id_privkey_chunk(ctx,abac_id_cert_chunk(ice), abac_id_privkey_chunk(ice));
+*/
+
+    abac_aspect_t *head=abac_aspect_new(1,abac_id_keyid(ice),"delicious");
+    abac_aspect_t *tail=abac_role_principal_create(abac_id_keyid(choco));
+
+    abac_attribute_t *attr=NULL;
+    abac_attribute_create(&attr, head, tail, 0);
+    if(attr==NULL) {
+        fprintf(stderr,"attr is not made\n");
+        return 1;
+    }
+
+    abac_attribute_bake(attr);
+
+    abac_context_load_id_id(ctx,choco);
+    abac_context_load_id_id(ctx,ice);
+
+    abac_context_load_attribute_chunk(ctx,abac_attribute_cert_chunk(attr));
+/*
+    abac_context_load_attribute(ctx,attr);
+    abac_context_load_attribute_chunk(ctx,abac_attribute_cert_chunk(attr));
+*/
+
+    show_yap_db("debug");
+
+    abac_credential_t *cred=NULL;
+    abac_credential_t **credentials=NULL;
+    int i;
+    int success=0;
+
+    credentials = abac_context_query_with_structure(ctx,
+                            head, tail,
+                            &success);
+    if (success)
+        puts("prover success!!");
+        else puts("prover failed!!");
+
+    if (credentials != NULL && success) {
+        puts("credentials needed :");
+        for (i = 0; credentials[i] != NULL; ++i) {
+           cred = credentials[i];
+           abac_print_cred_info(cred,NULL);
+        }
+    }
+    if(credentials)
+        abac_context_credentials_free(credentials);
+ 
+
+    return 0;
+}
Index: examples/example_scripts/java/build.xml
===================================================================
--- examples/example_scripts/java/build.xml	(revision 0cc535ebd0dcf65a8892a4db4207fdb6d1b91eb0)
+++ examples/example_scripts/java/build.xml	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -13,5 +13,5 @@
 
   <property name="src.dir" value="../../../swig/java"/>
-  <property name="lib.dir" value="/usr/local/lib"/>
+  <property name="lib.dir" value="./lib"/>
   <property name="build.dir" value="build"/>
   <property name="classes.dir" value="${build.dir}/classes"/>
Index: examples/example_scripts/java/run_prover
===================================================================
--- examples/example_scripts/java/run_prover	(revision 0cc535ebd0dcf65a8892a4db4207fdb6d1b91eb0)
+++ examples/example_scripts/java/run_prover	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -7,3 +7,3 @@
 javac -classpath ${keystore}/build/classes prover_test.java
 
-java -classpath ${keystore}/build/classes:. -Djava.library.path=/usr/local/lib prover_test ${keystore} IceCream delicious Chocolate
+java -classpath ${keystore}/build/classes:. prover_test ${keystore} IceCream delicious Chocolate
Index: examples/example_scripts/java/run_test
===================================================================
--- examples/example_scripts/java/run_test	(revision 0cc535ebd0dcf65a8892a4db4207fdb6d1b91eb0)
+++ examples/example_scripts/java/run_test	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -1,5 +1,10 @@
 #!/bin/sh
 
-export LD_LIBRARY_PATH=/usr/local/lib
+if [ "$LD_LIBRARY_PATH" = "" ] ; then
+    export LD_LIBRARY_PATH=.:/usr/local/lib
+else
+    export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
+fi
+
 
 if [ "$JAVA_HOME" = "" ] ; then
Index: examples/example_scripts/java/run_thread
===================================================================
--- examples/example_scripts/java/run_thread	(revision 0cc535ebd0dcf65a8892a4db4207fdb6d1b91eb0)
+++ examples/example_scripts/java/run_thread	(revision 91ecdfad6c73854e600d8051747099c41948ea55)
@@ -7,3 +7,3 @@
 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
+java -classpath ${keystore}/build/classes:. threaded_test ${keystore} IceCream delicious Chocolate
