Created
November 8, 2012 03:54
-
-
Save HungMingWu/4036678 to your computer and use it in GitHub Desktop.
JNI Tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <jni.h> | |
#include "HelloWorld.h" | |
#include <stdio.h> | |
JNIEXPORT void JNICALL Java_HelloWorld_sayHello (JNIEnv *env, jobject obj) { | |
printf("Hello,the World!!!\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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