[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Java Native Interface



Hello!

Does JNI work with DEBIAN???
If it does, how do i compile a C program to work with it.
I wrote the following example named foo.c:

#include "mienk_Native.h"
#include <stdio.h>
JNIEXPORT jint JNICALL Java_mienk_Native_field(JNIEnv * Kama, jclass
Kama1, jint port)
{
 FILE *kiFile;
 kiFile=fopen("out8081","wt");
 fprintf(kiFile,"whatever whatever \nend");
 close(kiFile);
 return port;
}

I have compiled it using 

gcc foo.c  -o libField.so -L/usr/lib -idirafter /usr/lib/jdk1.1/include/\
 -shared

Java loads the library, and the C opens the file but does not write in it
or can't close it.

I need your help. 
Thanks!

-------------------------------------------------------------------------------
Robert Horvath             Technical University of Budapest 



Reply to: