3 releases
0.0.3 | Nov 29, 2024 |
---|---|
0.0.2 | Nov 28, 2024 |
0.0.1 | Nov 27, 2024 |
#1163 in Development tools
431 downloads per month
27KB
511 lines
Auto JNI
Automatically create bindings to Java through JNI
This was created to simplify created bindings for frcrs and to make it easier to create bindings for other projects.
Auto JNI is a heavy work in progress and their are many features still being implemented.
- Initialize Classes
- Call Methods (static and instance)
- Create enums
- Improve API
- Add more examples
- Add more documentation
- Add more tests
- Add more error handling
- Add more logging
Example
Example.java
package com.example;
class Example {
public static int add(int a, int b) {
return a + b;
}
}
build.rs
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let out = env::var("OUT_DIR").unwrap();
let file = Path::new(&out).join("bindings.rs");
let class_name = vec![
"com.example.Example"
];
let class_path = Some("build".to_string());
let options = vec![
"-Djava.class.path=build".to_string(),
];
generate_bindings_file(class_name, class_path, &*file, Some(options)).expect("Failed to generate bindings");
}
Dependencies
~4–15MB
~139K SLoC