User Tools

Site Tools


make:makefile-java-and-c

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
make:makefile-java-and-c [2024/01/15 21:21] odeftamake:makefile-java-and-c [2024/01/15 21:23] (current) odefta
Line 67: Line 67:
 </code> </code>
  
 +Hello.java:
 +<code java Hello.java>
 +public class Hello {
 +    private native void sayHello();
  
 +    static {
 +        System.loadLibrary("hello");
 +    }
  
 +    public static void main(String[] args) {
 +        new Hello().sayHello();
 +    }
 +}
 +</code>
  
 +<code c hello.c>
 +#include <jni.h>
 +#include "Hello.h"
 +
 +JNIEXPORT void JNICALL Java_Hello_sayHello(JNIEnv *env, jobject obj) {
 +    printf("Hello from C!\n");
 +}
 +</code>
make/makefile-java-and-c.1705346489.txt.gz · Last modified: 2024/01/15 21:21 by odefta