jni_helper

Crates.iojni_helper
lib.rsjni_helper
version
sourcesrc
created_at2024-10-19 09:50:33.911599
updated_at2024-10-19 14:19:09.439241
descriptionjava function descriptor generate
homepage
repositoryhttps://github.com/pingfanH/jni_helper
max_upload_size
id1415227
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
pingfanh (pingfanH)

documentation

https://docs.rs/jni_helper/

README

Jni Function Descriptor Generate

Required

  • jdk
  • kotlinc(kotlin)

Usage

  • create build.rs in you project root
    use jni_helper;
    fn main() {
    jni_helper::kt("your/path/RustNative.kt","your/bin/kotlinc.bat","src/kt_jni.rs");//kt
    jni_helper::java("your/path/RustNative.java","your/bin/kotlinc.bat","src/java_jni.rs");//java
    jni_helper::custom("your/path/RustNative.kt",vec!["your/bin/javac","-d","classes/java","-encoding","UTF-8"],"src/java_jni.rs");//custom
    }
    
  • include!() jni.rs in your lib.rs
  • PS:If there are Chinese characters in the Java file, you need to include "-encoding", "UTF-8" in custom javac

Demo

Commit count: 14

cargo fmt