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

source

pub fn new() -> Self

Creates a new JavaRun instance with default values, which can be further customized using the builder methods.

source

pub fn run(&self) -> Result<ExitStatus>

Executes the java command based on this JavaRun instance.

source

pub fn command(&self) -> Result<Command>

Returns a Command based on this JavaRun instance that can be inspected or customized before being executed.

source

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.

source

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.

source

pub fn enable_preview_features( &mut self, enable_preview_features: bool ) -> &mut Self

Enable or disable preview language features.

source

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.

source

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.

source

pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self

Add an argument to be passed to the main class being run by java.

source

pub fn args<I>(&mut self, args: I) -> &mut Self
where I: IntoIterator, I::Item: AsRef<OsStr>,

Adds multiple arguments to be passed to the main class being run by java.

Trait Implementations§

source§

impl Clone for JavaRun

source§

fn clone(&self) -> JavaRun

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for JavaRun

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for JavaRun

source§

fn default() -> JavaRun

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.