java调用rust 共享库的一些方法简单说明
java 与rust 的调用,核心还是基于jni 进行处理,rust社区实现了不少方便的工具可以提供rust 到c 的处理(比如生成头文件)
以下是整理的一些资料,方便学习
几个不错的包
- jni-rs
目前还在活跃更新中,同时github 的start 也比较多,同时不少开源软件在用,比如questdb - robusta
一个比较新的项目,使用上比较简单,但是目前还是有一些缺点,具体可以参考官方文档 - panama以及周边项目
实际上panama并不是rust 周边的,但是可以加速jni 的开发,比如我们已经构建好rust 的共享库之后,基于此可以
方便java 代码使用 - graalvm 的native 能力
graalvm 对于native 的处理也比较强大,而且是oracle 官方的,也是不错的选择
说明
参考资料中包含了一些链接,可以方便参考学习
参考资料
https://openjdk.org/projects/panama/
https://github.com/openjdk/jextract
https://github.com/jni-rs/jni-rs
https://docs.rs/jni/latest/jni/
https://github.com/mozilla/cbindgen
https://github.com/MaulingMonkey/jni-bindgen
https://github.com/mozilla/uniffi-rs
https://questdb.io/blog/leveraging-rust-in-our-high-performance-java-database/
https://github.com/questdb/rust-maven-plugin
https://github.com/giovanniberti/robusta
https://github.com/java-native-access/jna
https://www.graalvm.org/latest/reference-manual/native-image/guides/build-native-shared-library/
https://www.baeldung.com/java-project-panama
https://docs.oracle.com/javase/8/docs/technotes/guides/jni/
https://www.baeldung.com/jni
https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/jniTOC.html
https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/
https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/C-API/
https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/JNI/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2022-12-29 dremio UserServer 简单说明
2022-12-29 dremio jdbc 客户端简单说明
2022-12-29 dremio 参考配置参考
2020-12-29 riptide zalando 团队开源的spring客户端响应路由解决方案
2020-12-29 golang mustache 模版引擎试用
2020-12-29 Jeffail/tunny goroutine 池工具
2019-12-29 mjml nodejs 集成