Struct android_build::JavaRun
source · pub struct JavaRun { /* private fields */ }
Expand description
A builder for a java
command that can be invoked.
If you need to customize the java
command beyond what is provided here,
you can use the JavaRun::command()
method to get a Command
that can be further customized with additional arguments.
Documentation on java
options are based on
https://dev.java/learn/jvm/tools/core/java/.
Implementations§
source§impl JavaRun
impl JavaRun
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new JavaRun
instance with default values,
which can be further customized using the builder methods.
sourcepub fn run(&self) -> Result<ExitStatus>
pub fn run(&self) -> Result<ExitStatus>
Executes the java
command based on this JavaRun
instance.
sourcepub fn command(&self) -> Result<Command>
pub fn command(&self) -> Result<Command>
Returns a Command
based on this JavaRun
instance
that can be inspected or customized before being executed.
sourcepub fn java_home<P: AsRef<OsStr>>(&mut self, java_home: P) -> &mut Self
pub fn java_home<P: AsRef<OsStr>>(&mut self, java_home: P) -> &mut Self
Override the default JAVA_HOME
path.
If not set, the default path is found using the JAVA_HOME
env var.
sourcepub fn class_path<S: AsRef<OsStr>>(&mut self, class_path: S) -> &mut Self
pub fn class_path<S: AsRef<OsStr>>(&mut self, class_path: S) -> &mut Self
Specify where to find user class files.
If no class paths are provided, the current directory will be used.
sourcepub fn enable_preview_features(
&mut self,
enable_preview_features: bool
) -> &mut Self
pub fn enable_preview_features( &mut self, enable_preview_features: bool ) -> &mut Self
Enable or disable preview language features.
sourcepub fn main_class<S: AsRef<OsStr>>(&mut self, class: S) -> &mut Self
pub fn main_class<S: AsRef<OsStr>>(&mut self, class: S) -> &mut Self
Specify the main class to launch when running the java
command.
Note that this and the jar_file
are mutually exclusive;
only one can be chosen at a time.
sourcepub fn jar_file<P: AsRef<OsStr>>(&mut self, jar_file: P) -> &mut Self
pub fn jar_file<P: AsRef<OsStr>>(&mut self, jar_file: P) -> &mut Self
Specify the JAR file to run with the java
command.
Note that this and the main_class
are mutually exclusive;
only one can be chosen at a time.