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

public Class Exec

extends Task
Class Inheritance
Annotations
@Deprecated
Imports
java.io.BufferedReader, .File, .FileWriter, .IOException, .InputStream, .InputStreamReader, .PrintWriter, java.util.Locale, org.apache.tools.ant.BuildException, .MagicNames, .Project, .Task

Deprecated

since 1.2. delegate to Execute instead.

Executes a given command if the os platform is appropriate.

As of Ant 1.2, this class is no longer the implementation of Ant's <exec> task - it is considered to be dead code by the Ant developers and is unmaintained. Don't use it.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private String
private File
private boolean
protected PrintWriter
private String
private String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Exec()

Constructor for Exec.

Method Summary

Modifier and TypeMethod and Description
public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task.
protected void
logFlush()

Close output.

protected void
outputLog(String
the line to putput
line
,
int
the level of logging - ignored if output is going to a file
messageLevel
)

Log an output message.

protected int

Returns:

the exit value of the command
run
(String
the command to exec
command
)

Execute the command.

public void
setCommand(String
a String value
command
)

Set the command to exec.

public void
setDir(String
a String value
d
)

Set the directory.

public void
setFailonerror(boolean
a boolean value
fail
)

Set the failOnError attribute.

public void
setOs(String
a String value
os
)

Set the Operating System that this exec is to run in.

public void
setOutput(String
a String value
out
)

Set the output filename.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

commandback to summary
private String command
dirback to summary
private File dir
failOnErrorback to summary
private boolean failOnError
fosback to summary
protected PrintWriter fos
osback to summary
private String os
outback to summary
private String out

Constructor Detail

Execback to summary
public Exec()

Constructor for Exec. Prints a warning message to std error.

Method Detail

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task.

Annotations
@Override
Exceptions
BuildException:
on error
logFlushback to summary
protected void logFlush()

Close output.

outputLogback to summary
protected void outputLog(String line, int messageLevel)

Log an output message.

Parameters
line:String

the line to putput

messageLevel:int

the level of logging - ignored if output is going to a file

runback to summary
protected int run(String command) throws BuildException

Execute the command.

Parameters
command:String

the command to exec

Returns:int

the exit value of the command

Exceptions
BuildException:
on error
setCommandback to summary
public void setCommand(String command)

Set the command to exec.

Parameters
command:String

a String value

setDirback to summary
public void setDir(String d)

Set the directory.

Parameters
d:String

a String value

setFailonerrorback to summary
public void setFailonerror(boolean fail)

Set the failOnError attribute. Default is false.

Parameters
fail:boolean

a boolean value

setOsback to summary
public void setOs(String os)

Set the Operating System that this exec is to run in.

Parameters
os:String

a String value

setOutputback to summary
public void setOutput(String out)

Set the output filename.

Parameters
out:String

a String value

org.apache.tools.ant.taskdefs back to summary

pack-priv Class Exec.StreamPumper

extends Thread
Class Inheritance

Field Summary

Modifier and TypeField and Description
private BufferedReader
private boolean
private int
private static final int
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
public
StreamPumper(InputStream is, int messageLevel)

Method Summary

Modifier and TypeMethod and Description
public void
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.
Inherited from java.lang.Thread:
activeCountcheckAccessclonecountStackFramescurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitresumesetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopsuspendthreadIdtoStringyield

Field Detail

dinback to summary
private BufferedReader din
endOfStreamback to summary
private boolean endOfStream
messageLevelback to summary
private int messageLevel
SLEEP_TIMEback to summary
private static final int SLEEP_TIME

Constructor Detail

StreamPumperback to summary
public StreamPumper(InputStream is, int messageLevel)

Method Detail

pumpStreamback to summary
public void pumpStream() throws IOException
runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

Annotations
@Override