Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.launcher

public Class CommandLauncher

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.taskdefs.launcher.CommandLauncherProxy, org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher
Static Imports
org.apache.tools.ant.MagicNames.ANT_SHELL_LAUNCHER_REF_ID, .MagicNames.ANT_VM_LAUNCHER_REF_ID

A command launcher for a particular JVM/OS platform. This class is a general purpose command launcher which can only launch commands in the current working directory.

Field Summary

Modifier and TypeField and Description
protected static final FileUtils
private static CommandLauncher
private static CommandLauncher

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Process

Returns:

the created Process.
exec
(Project
The project that the command is part of.
project
,
String[]
The command to execute.
cmd
,
String[]
The environment for the new process. If null, the environment of the current process is used.
env
)

Launches the given command in a new process.

public Process

Returns:

the created Process.
exec
(Project
The project that the command is part of.
project
,
String[]
The command to execute.
cmd
,
String[]
The environment for the new process. If null, the environment of the current process is used.
env
,
File
The directory to start the command in. If null, the current directory is used.
workingDir
)

Launches the given command in a new process, in the given working directory.

private static CommandLauncher
extractLauncher(String referenceName, Project project)

public static CommandLauncher

Returns:

CommandLauncher
getShellLauncher
(Project
Project
project
)

Obtains the shell launcher configured for the given project or the default shell launcher.

private static CommandLauncher
getSystemLauncher(String launcherRefId)

public static CommandLauncher

Returns:

CommandLauncher
getVMLauncher
(Project
Project
project
)

Obtains the VM launcher configured for the given project or the default VM launcher.

public static void
setShellLauncher(Project
Project
project
,
CommandLauncher
CommandLauncher
launcher
)

Sets the shell launcher to use for the given project.

public static void
setVMLauncher(Project
Project
project
,
CommandLauncher
CommandLauncher
launcher
)

Sets the VM launcher to use for the given project.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FILE_UTILSback to summary
protected static final FileUtils FILE_UTILS
shellLauncherback to summary
private static CommandLauncher shellLauncher
vmLauncherback to summary
private static CommandLauncher vmLauncher

Constructor Detail

CommandLauncherback to summary
public CommandLauncher()

Method Detail

execback to summary
public Process exec(Project project, String[] cmd, String[] env) throws IOException

Launches the given command in a new process.

Parameters
project:Project

The project that the command is part of.

cmd:String[]

The command to execute.

env:String[]

The environment for the new process. If null, the environment of the current process is used.

Returns:Process

the created Process.

Exceptions
IOException:
if attempting to run a command in a specific directory.
execback to summary
public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException

Launches the given command in a new process, in the given working directory.

Parameters
project:Project

The project that the command is part of.

cmd:String[]

The command to execute.

env:String[]

The environment for the new process. If null, the environment of the current process is used.

workingDir:File

The directory to start the command in. If null, the current directory is used.

Returns:Process

the created Process.

Exceptions
IOException:
if trying to change directory.
extractLauncherback to summary
private static CommandLauncher extractLauncher(String referenceName, Project project)
getShellLauncherback to summary
public static CommandLauncher getShellLauncher(Project project)

Obtains the shell launcher configured for the given project or the default shell launcher.

Parameters
project:Project

Project

Returns:CommandLauncher

CommandLauncher

getSystemLauncherback to summary
private static CommandLauncher getSystemLauncher(String launcherRefId)
getVMLauncherback to summary
public static CommandLauncher getVMLauncher(Project project)

Obtains the VM launcher configured for the given project or the default VM launcher.

Parameters
project:Project

Project

Returns:CommandLauncher

CommandLauncher

setShellLauncherback to summary
public static void setShellLauncher(Project project, CommandLauncher launcher)

Sets the shell launcher to use for the given project.

Parameters
project:Project

Project

launcher:CommandLauncher

CommandLauncher

setVMLauncherback to summary
public static void setVMLauncher(Project project, CommandLauncher launcher)

Sets the VM launcher to use for the given project.

Parameters
project:Project

Project

launcher:CommandLauncher

CommandLauncher