I am having trouble compiling the following program
PPConverter.java:
public class PPConverter {
private native void convert(String s);
public static void main(String[] args){
new PPConverter().convert(args[0]);
}
static {
System.loadLibrary("converter");
}
}
converter.c:
#include <jni.h>
#include <stdio.h>
#include "PPConverter.h"
JNIEXPORT void JNICALL Java_PPConverter_convert (JNIEnv *, jobject, jstring){
printf(jstring);
return;
}
Since I'm working on UNIX, I use the following command to compile the converter.c file:
cc -I/usr/lib/jvm/java-6-openjdk/include converter.c -o libconverter.so
but I get the following errors:
converter.c: In function รขJava_PPConverter_convertรข:
converter.c:5: error: parameter name omitted
converter.c:5: error: parameter name omitted
converter.c:5: error: parameter name omitted
converter.c:6: error: expected expression before รขjstringรข
What am I doing wrong?
source
share