PatchBukkit/rust/src/java/java_to_rust.rs
Alexander Medvedev 6de65a0f3f Initial commit
Co-Authored-By: Bjorn Beishline <75190918+bjorntheprogrammer@users.noreply.github.com>
2026-01-21 19:20:07 +01:00

11 lines
393 B
Rust

use j4rs::prelude::*;
use j4rs_derive::*;
#[call_from_java("io.github.astonbitecode.j4rs.example.RustSimpleFunctionCall.fnnoargs")]
fn my_function_with_no_args() {
println!("Hello from the Rust world!");
// If you need to have a Jvm here, you need to attach the thread
let _jvm = Jvm::attach_thread().unwrap();
// Now you may further call Java classes and methods as usual!
}