make:makefile-java-and-c
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
make:makefile-java-and-c [2024/01/15 21:19] – created odefta | make:makefile-java-and-c [2024/01/15 21:23] (current) – odefta | ||
---|---|---|---|
Line 52: | Line 52: | ||
</ | </ | ||
+ | To compile the programs: | ||
+ | < | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | To run the program: | ||
+ | < | ||
+ | make run | ||
+ | </ | ||
+ | |||
+ | To cleanup the built files: | ||
+ | < | ||
+ | make clean | ||
+ | </ | ||
+ | |||
+ | Hello.java: | ||
+ | <code java Hello.java> | ||
+ | public class Hello { | ||
+ | private native void sayHello(); | ||
+ | |||
+ | static { | ||
+ | System.loadLibrary(" | ||
+ | } | ||
+ | |||
+ | public static void main(String[] args) { | ||
+ | new Hello().sayHello(); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code c hello.c> | ||
+ | #include < | ||
+ | #include " | ||
+ | |||
+ | JNIEXPORT void JNICALL Java_Hello_sayHello(JNIEnv *env, jobject obj) { | ||
+ | printf(" | ||
+ | } | ||
+ | </ |
make/makefile-java-and-c.1705346366.txt.gz · Last modified: 2024/01/15 21:19 by odefta