-import ThreadBrand;
+import ltt.*;
// The Sample.java file
public class TestBrand
{
public static void main(String[] args)
{
- ThreadBrand.trace_java_generic_thread_brand("Brand_test");
+ ltt.ThreadBrand.trace_java_generic_thread_brand("Brand_test");
}
}
+
+package ltt;
+
// The ThreadBrand.java file
public class ThreadBrand
{
// Declaration of the Native (C) function
- private static native void trace_java_generic_thread_brand(String arg);
+ public static native void trace_java_generic_thread_brand(String arg);
static {
System.loadLibrary("ltt-java-thread_brand");
}
#!/bin/sh
+export CLASSPATH=.:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/bin
+
#Sample
javac Sample.java
-CLASSPATH=.:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/bin javah -jni Sample
+javah -jni Sample
gcc -I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include \
-I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include/linux \
-shared -Wl,-soname,libltt-java-string \
LD_LIBRARY_PATH=. java Sample
#TestBrand
-javac TestBrand.java
-CLASSPATH=.:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/bin javah -jni TestBrand
+echo javac Threadbrand
+javac -d . ThreadBrand.java
+echo javah Threadbrand
+javah -jni ltt.ThreadBrand
+echo gcc
gcc -I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include \
-I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include/linux \
-shared -Wl,-soname,libltt-java-thread_brand \
-o libltt-java-thread_brand.so ltt-java-thread_brand.c \
../ltt-facility-loader-user_generic.c
+echo javac test
+javac TestBrand.java
+echo run
LD_LIBRARY_PATH=. java TestBrand
#define LTT_BLOCKING 1
#include <ltt/ltt-facility-user_generic.h>
-JNIEXPORT void JNICALL Java_ThreadBrand_trace_1java_1generic_1thread_brand
- (JNIEnv *env, jobject obj, jstring jstr)
+JNIEXPORT void JNICALL Java_ltt_ThreadBrand_trace_1java_1generic_1thread_1brand
+ (JNIEnv *env, jclass jc, jstring jstr)
{
const char *str;
str = (*env)->GetStringUTFChars(env, jstr, NULL);