I am trying to emulate the test cases at https://github.com/jni-rs/jni-rs/blob/master/tests/jni_api.rs and https://github.com/jni-rs/jni-rs/blob/master/tests/util/mod.rs . I have created a project with main.rs
use jni::{InitArgsBuilder, JNIVersion, JavaVM};
fn main() {
let jvm_args = InitArgsBuilder::new()
.version(JNIVersion::V8)
.option("-Xcheck:jni")
//.option(format!("-Djava.class.path={}", heinous_classpath()))
.build()
.unwrap_or_else(|e| panic!("{}", e.display_chain().to_string()));
let jvm = JavaVM::new(jvm_args);
}
and Cargo.toml:
[package]
name = "rust_call_jni"
version = "0.1.0"
authors = ["Robert Forsman <git@thoth.purplefrog.com>"]
edition = "2018"
[dependencies]
jni = "0.12.3"
When I do a cargo build
I get the following error:
error[E0432]: unresolved import `jni::InitArgsBuilder`
--> src/main.rs:1:11
|
1 | use jni::{InitArgsBuilder, JNIVersion, JavaVM};
| ^^^^^^^^^^^^^^^ no `InitArgsBuilder` in the root
error[E0599]: no function or associated item named `new` found for type `jni::wrapper::java_vm::vm::JavaVM` in the current scope
--> src/main.rs:12:23
|
12 | let jvm = JavaVM::new(jvm_args);
| --------^^^
| |
| function or associated item not found in `jni::wrapper::java_vm::vm::JavaVM`
I'm using Rust 1.34.2.
How can I modify my source code to properly import and invoke the constructors?