This commit is contained in:
2020-01-30 21:07:23 +08:00
parent 62f7aad67b
commit 139ee9fe6f
4 changed files with 84 additions and 0 deletions

18
jni/HelloWorld.java Normal file
View File

@@ -0,0 +1,18 @@
public class HelloWorld {
// This declares that the static `hello` method will be provided
// a native library.
private static native String hello(String input);
static {
// This actually loads the shared object that we'll be creating.
// The actual location of the .so or .dll may differ based on your
// platform.
System.loadLibrary("samplejni");
}
// The rest is just regular ol' Java!
public static void main(String[] args) {
String output = HelloWorld.hello("josh");
System.out.println(output);
}
}