Skip to content

fb64/java-ffm-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Java FFM API with Rust demo

This repository shows how to use Java 25 FFM API with a rust library.

Rust Lib

Install Rust is required to build the native library under the rust_lib folder

Build the native library

cd rust_lib
cargo build --release

FFM App

Java 25 is required to build the demo application under the ffm_app folder.

Build the demo application

cd ffm_app
./mvnw clean compile

Run the demo application (from the ffm_app folder) With Maven

./mvnw exec:exec -Daction=ACTION

With java command

java -Djava.library.path=../rust_lib/target/release --enable-native-access=fr.flob.ffm -p target/classes -m fr.flob.ffm/fr.flob.ffm.App ACTION

With ACTION is one of the following:

  • hello run the simple hello from rust
  • read call rust function that read on a shared memory
  • write call rust function that read and modify on a shared memory

Java command options:

  • -Djava.library.path: folder where the native library is located
  • --enable-native-access: enable Java Native Access for the application module
  • -p: module path of the application
  • -m: module main class of the application

About

Java FFM api demo with rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published