We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FindClass failed for java/util/OptionalDouble
I am using it in a JDK6 environment and I would like to know how to remove java.util.Optional related classes during build.
java.util.Optional
Is there a way to disable java.util.Optional for running in a JDK6 environment?
I tried to remove only java.util.OptionalDouble by adding this code to jni_typemaps.rs and building, but java.util.OptionalDouble is not removed.
java.util.OptionalDouble
jni_typemaps.rs
mod swig_foreign_types_map {} #[allow(dead_code)] fn to_java_util_opt_double(env: *mut JNIEnv, x: Option<f64>) -> f64 { match x { Some(val) => val, None => 0.0, } } foreign_typemap!( ($p:r_type) Option<f64> => f64 { $out = to_java_util_opt_double(env, $p); }; (f_type, option = "NoNullAnnotations") => "double"; (f_type, option = "NullAnnotations") => "@NonNull double"; ); foreign_typemap!( ($p:r_type) Option<f32> => f32 { $out = to_java_util_opt_double(env, $p.map(f64::from)); }; );
Below is the main function code of build.rs
build.rs
fn main() { env_logger::init(); let out_dir = env::var("OUT_DIR").unwrap(); let jni_c_headers_rs = Path::new(&out_dir).join("jni_c_header.rs"); gen_jni_bindings(&jni_c_headers_rs); let have_java_9 = fs::read_to_string(&jni_c_headers_rs) .unwrap() .contains("JNI_VERSION_9"); let java_cfg = JavaConfig::new( Path::new("lib") .join("src") .join("main") .join("java") .join("com") .join("example"), "com.example".into()) //.use_optional_package("com.google.common.base".into()) .use_reachability_fence(if have_java_9 { JavaReachabilityFence::Std } else { JavaReachabilityFence::GenerateFence(8) }); let out_dir = env::var("OUT_DIR").unwrap(); let in_src = Path::new("src").join("java_glue.rs.in"); let out_src = Path::new(&out_dir).join("java_glue.rs"); let flap_gen = flapigen::Generator::new(LanguageConfig::JavaConfig(java_cfg)) .merge_type_map("typemaps", include_str!("src/jni_typemaps.rs")); flap_gen.expand("java bindings", &in_src, &out_src); }
Errors that occur when running in a JDK6 environment
thread '<unnamed>' panicked at /target/x86_64-unknown-linux-gnu/release/build/enigma-0323bbf5eaf7b330/out/java_glue.rs:11:3134: FindClass failed for java/util/OptionalDouble note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread '<unnamed>' panicked at library/core/src/panicking.rs:221:5: panic in a function that cannot unwind stack backtrace: 0: 0x735c9dc805d5 - <unknown> 1: 0x735c9dcabdcb - <unknown> 2: 0x735c9dc7d31f - <unknown> 3: 0x735c9dc818d1 - <unknown> 4: 0x735c9dc815ac - <unknown> 5: 0x735c9dc81fa1 - <unknown> 6: 0x735c9dc81dd3 - <unknown> 7: 0x735c9dc80a99 - <unknown> 8: 0x735c9dc81a94 - <unknown> 9: 0x735c9dca9795 - <unknown> 10: 0x735c9dca9822 - <unknown> 11: 0x735c9dca9966 - <unknown> 12: 0x735c9d725f9b - JNI_OnLoad 13: 0x735cacb8ad0c - Java_java_lang_ClassLoader_00024NativeLibrary_load thread caused non-unwinding panic. aborting. Aborted (core dumped)
Could you please tell me the build configuration to remove java.util.OptionalX so that it can work properly on JDK6?
java.util.OptionalX
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using it in a JDK6 environment and I would like to know how to remove
java.util.Optional
related classes during build.Is there a way to disable
java.util.Optional
for running in a JDK6 environment?I tried to remove only
java.util.OptionalDouble
by adding this code tojni_typemaps.rs
and building, butjava.util.OptionalDouble
is not removed.jni_typemaps.rs
Below is the main function code of
build.rs
Errors that occur when running in a JDK6 environment
Could you please tell me the build configuration to remove
java.util.OptionalX
so that it can work properly on JDK6?The text was updated successfully, but these errors were encountered: