Running a program in Rust

Hello?
I wanted to know how to run a program in Rust?
I want to execute the code below within Rust code!
To run the program like this:

c:/java/jdk-23/bin/java.exe -jar /MyApp/WindowJAR.jar

Example:


    pub fn r_open_program(&self, nome_programa: &str) {
        let _ = Command::new(nome_programa).spawn();
    }

        r.r_open_program("c:/java/jdk-23/bin/java.exe -jar /MeuApp/WindowJAR.jar");

As explained in the documentation of Command::new, Command::new() only accepts the name of the program, which in your case would be "c:/java/jdk-23/bin/java.exe". The arguments need to be passed in with the arg() or args() functions. So what you want is:

Command::new("c:/java/jdk-23/bin/java.exe")
    .arg("-jar")
    .arg("MeuApp/WindowJAR.jar")

and then you can call spawn(), output() or status() to launch the process, depending on what you need.