Andreas, Here it is an example of how to use C code in Java. The example includes the use of String, booleans, Integers, arrays as parameters and results of methods. It also includes an example of modifying a var in Java from the C code. It is pretty easy if you follow the tutorial in http://java.sun.com/docs/books/tutorial/native1.1/implementing/index.html However, the tutorial lacks of a better reference manual, in some functions I had to guess the parameters and their order, although they were pretty straight forward. Here is the "tutorial" for this. I guess that this and a small tutorial (StreetRouter) on how to make Visigenic proxies is what the San Diego SuperComputer Center needs. Tutorial : Using C code from Java, just follow these steps: 1- create a java class which is going to encapsulate the C code you have. "CORBAwrapper.java" public class CORBAwrapper { public static int myvalue; public native void printmessage(); public native String Sls(String collection); public native String Sls(); public native boolean testboolean(boolean myboolean); public native int testinteger(int myinteger); public native int testarrayint(int[] myarray); public native String[] testarrayStrings(String[] myarray); public native void testreferences(); public void calltestreferences() { this.myvalue = 9; System.out.println("My value is: " + this.myvalue); testreferences(); System.out.println("The value in java now is " + this.myvalue); return; } static { System.loadLibrary("SRBCorba"); } } "SRBCorba" is the name of the library with your C code. In the case of solaris the name of the file is going to be like "libSRBCorba.so" 2- Create a java class which is going to create a CORBAwrapper object and call its method. This is my test script. "test.java" public class test { public static void main(String[] args) { CORBAwrapper SRBCorba = new CORBAwrapper(); SRBCorba.printmessage(); System.out.println("\nTesting Strings\n"); System.out.println("Calling a method with no param and return type String"); System.out.println(SRBCorba.Sls()); System.out.println("Calling a method with param String and return type Strin g"); System.out.println("The param is " + args[0]); System.out.println(SRBCorba.Sls(args[0])); System.out.println("\nTesting Booleans\n"); System.out.println("Calling a method with param Boolean and return type Bool ean"); System.out.println("What Java gets is: " + SRBCorba.testboolean(true)); System.out.println("\nTesting Integers\n"); System.out.println("Calling a method with param Int and return type Int"); System.out.println("What Java gets is: " + SRBCorba.testinteger(23)); System.out.println("\nTesting arrays\n"); System.out.println("Calling a method with param array of Int and return type an Int"); int[] myarray = new int[4]; myarray[0] = 1; myarray[1] = 2; myarray[2] = 3; myarray[3] = 4; System.out.println("What Java gets is: " + SRBCorba.testarrayint(myarray)); System.out.println("\nCalling a method with param array of Strings and retur n type array of Strings\n"); String[] Stringarray = new String[2]; Stringarray[0] = "Hi"; Stringarray[1] = args[0]; System.out.println("What Java gets from C is: \n"); String[] arrayresult = SRBCorba.testarrayStrings(Stringarray); for(int i=0;i #include #include JNIEXPORT void JNICALL Java_CORBAwrapper_printmessage (JNIEnv *env, jobject obj) { printf("This is the C library for SRB CORBA example\n"); printf("Now you are using a C API from Java\n"); } JNIEXPORT jstring JNICALL Java_CORBAwrapper_Sls__Ljava_lang_String_2 (JNIEnv *env, jobject obj, jstring collection) { char buf[128]; /*Extracting information from the parameter */ const char *str = (*env)->GetStringUTFChars(env, collection, 0); printf("This is the string that I got from Java\n"); printf("%s\n", str); /*Releasing the Java String once you have got the C string is very important!!!*/ (*env)->ReleaseStringUTFChars(env, collection, str); /*Creating the returning string*/ printf("Sending bye bye\n"); strcpy(buf,"bye bye "); strcat(buf,str); return (*env)->NewStringUTF(env, buf); } JNIEXPORT jstring JNICALL Java_CORBAwrapper_Sls__ (JNIEnv *env, jobject obj) { jstring mystring; mystring = (*env)->NewStringUTF(env,"Hi"); return(mystring); } JNIEXPORT jboolean JNICALL Java_CORBAwrapper_testboolean (JNIEnv *env, jobject obj, jboolean myboolean) { printf("This is what C gets from Java"); if (myboolean) { printf("TRUE"); } else { printf("FALSE"); } return(1==0); } JNIEXPORT jint JNICALL Java_CORBAwrapper_testinteger (JNIEnv *env, jobject obj, jint myinteger) { jint result = 30; printf("This is what C gets from Java"); printf("%d",myinteger); printf("\n"); printf("Adding %d", result); result = result + myinteger; return(result); } JNIEXPORT jint JNICALL Java_CORBAwrapper_testarrayint (JNIEnv *env, jobject obj, jintArray myarray) { int i,sum = 0; jsize len; jint *body; printf("What C gets from java is:\n"); /*First we get the length of the array*/ len = (*env)->GetArrayLength(env, myarray); printf("The length of the array is: %d%\n", len); body = (*env)->GetIntArrayElements(env, myarray, 0); for (i=0; iReleaseIntArrayElements(env, myarray, body, 0); return(sum); } JNIEXPORT jobjectArray JNICALL Java_CORBAwrapper_testarrayStrings (JNIEnv *env, jobject obj, jobjectArray myarray) { int i; jsize len; jobject myobj; const char *str; jstring mystring; printf("This is what C gets from Java\n"); len = (*env)->GetArrayLength(env, myarray); printf("The length of the array is : %d%\n", len); printf("Elements in the array:\n"); for(i =0;iGetObjectArrayElement(env, myarray,i); str = (*env)->GetStringUTFChars(env, myobj, 0); printf(str); printf("\n"); } /*Modifying the array we return*/ printf("Modifying the array we return\n"); mystring = (*env)->NewStringUTF(env, "Gerard Rodriguez"); (*env)->SetObjectArrayElement(env,myarray,1,mystring); return(myarray); } JNIEXPORT void JNICALL Java_CORBAwrapper_testreferences (JNIEnv *env, jobject obj) { jclass cls; jfieldID fid; jint myint; printf("Accessing myvalue directly from C\n"); cls = (*env)->GetObjectClass(env,obj); fid = (*env)->GetStaticFieldID(env,cls,"myvalue","I"); if (fid == 0) { printf("Error accessing myvalue"); return; } myint =(*env)->GetStaticIntField(env,cls,fid); printf("the value is %d%\n", myint); printf("Now we change the value from C\n"); (*env)->SetStaticIntField(env, cls, fid, 200); return; } 6- Compile the C code and create a shared library "libSRBCorba.so" gcc -G -I/usr/local/src/ftp.javasoft.com/java/include -I/usr/loc al/src/ftp.javasoft.com/java/include/solaris CImpl.c -o libSRBCorba.so Remember to set "/usr/local/src/ftp.javasoft.com/java/" to whatever your java compiler is. 7- Now you are ready to run the test "java test [any string]" this should print out several messages on the screen. If it doesn't, probably it is because you don't have your LD_LIBRARY_PATH env var set properly. Make sure your ".", the directory where the libSRBCorba.so should be, is in the LD_LIBRARY_PATH.