This is just a test repo for jni
Currently tested:
- Basic JNI
- Access and use recsources from Java (variables and methods)
- Modify resources in Java.
- Combine with other self-built c libraries
Compile command (for window only):
- Install cygwin (Link: https://www.cygwin.com/)
- Add these 2 packages while installing:
mingw64-x86_64-gcc-core
for C andmingw64-x86_64-gcc-g++
for c++ - Open cygwin, move to the current project folder
3a. To make Hello.dll lib, use this command
x86_64-w64-mingw32-gcc -I"%JAVA_HOME%\include" -I"%JAVA_HOME%\include\win32" -shared -o hello.dll HelloJNI.c
3b. To make Sort.dll, move to test folder and use this commandx86_64-w64-mingw32-gcc -I"%JAVA_HOME%\include" -I"%JAVA_HOME%\include\win32" -shared -o Sort.dll Sort.c bbsort.c
- Run the java program.
For more information: https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html