在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):gkubisa/jni-maven开源软件地址(OpenSource Url):https://github.com/gkubisa/jni-maven开源编程语言(OpenSource Language):Java 74.9%开源软件介绍(OpenSource Introduction):jni-mavenjni-maven is a sample project intended to be used as a template for Java applications using JNI. RequirementsYou'll need the following:
Usagegit clone https://github.com/gkubisa/jni-maven.git jni-maven
cd jni-maven
mvn package
java -cp target/jni-maven-1.0-SNAPSHOT.jar ie.agisoft.App How it worksmaven-antrun-plugin is added to the process-classes phase of the build. It is used to:
The Makefile compiles the native code from src/main/c++ into *.o files which are stored in target/c++. Then it runs the linker which produces a single *.so object stored in target/classes. Because the *.so file is in target/classes, it's included in the final JAR file. This way the whole project produces a single artifact and can be easily used as a dependency by other Maven projects. The final bit is the custom module loader LibraryLoader.loadLibrary, which extracts the native library from the jar into a temporary file and loads it - the standard System.loadLibrary cannot do it. Limitations / possible improvements
Patches welcome! Credits
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论