java-tutorials/jni/src/main/cpp/generateNativeLibMac.sh
Miguel Rivero 62b5a591af BAEL-1637: Guide to JNI(Java Native Interface) (#4066)
* BAEL-1546: Java 8 Math additions

* Applied feedback to Unit Tests

* BAEL-1546 Added missing test annotations

* Added code for BAEL-1637

* Added script for Windows C++ code compile

* Added compilation script for MacOS

* Added some Unit tests
2018-05-15 22:18:41 +01:00

6 lines
695 B
Bash
Executable File

# Create the header with javac -h . ClassName.java
# Remember to set your JAVA_HOME env var
g++ -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin com_baeldung_jni_HelloWorldJNI.cpp -o com_baeldung_jni_HelloWorldJNI.o
g++ -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin com_baeldung_jni_ExampleParametersJNI.cpp -o com_baeldung_jni_ExampleParametersJNI.o
g++ -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin com_baeldung_jni_ExampleObjectsJNI.cpp -o com_baeldung_jni_ExampleObjectsJNI.o
g++ -dynamiclib -o ../../../native/macos/libnative.dylib com_baeldung_jni_HelloWorldJNI.o com_baeldung_jni_ExampleParametersJNI.o com_baeldung_jni_ExampleObjectsJNI.o -lc