Rust and JNI: unable to call method with Double parameter

⚓ rust    📅 2025-06-16    👤 surdeus    👁️ 3      

surdeus

Hello everyone,
I'm trying to call java method with 1 double parameters, but got signature exception:

java method:

public void setPrice(Double value)
    {
        this.price = value;
    }

rust side:

let val = JValue::Double(65000.00);
        jenv.call_method(&item1, "setPrice", "(Ljava/lang/Double;)V", &[val])
            .unwrap();

exception:

called `Result::unwrap()` on an `Err` value: InvalidArgList(TypeSignature { args: [Object("java/lang/Double")], ret: Primitive(Void) })

any ideas what I'm doing wrong?

thanks!

1 post - 1 participant

Read full topic

🏷️ rust_feed