Skip to content

Instantly share code, notes, and snippets.

@HungMingWu
Created November 8, 2012 03:54
Show Gist options
  • Save HungMingWu/4036678 to your computer and use it in GitHub Desktop.
Save HungMingWu/4036678 to your computer and use it in GitHub Desktop.
JNI Tutorial
#include <jni.h>
#include "HelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_HelloWorld_sayHello (JNIEnv *env, jobject obj) {
printf("Hello,the World!!!\n");
}
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: HelloWorld
* Method: sayHello
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_HelloWorld_sayHello
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
class HelloWorld {
public native void sayHello();
static {
System.loadLibrary("HelloWorld");
}
public static void main(String[] args) {
(new HelloWorld()).sayHello();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment