org.apache.tools.ant.taskdefs
Class ExecuteJava
java.lang.Object
org.apache.tools.ant.taskdefs.ExecuteJava
- Runnable, TimeoutObserver
public class ExecuteJava
extends java.lang.Object
Execute a Java class.
execute
public void execute(Project project)
throws BuildException
Execute the Java class against the specified Ant Project.
project
- the Project to use.
fork
public int fork(ProjectComponent pc)
throws BuildException
Run the Java command in a separate VM, this does not give you
the full flexibility of the Java task, but may be enough for
simple needs.
pc
- the ProjectComponent to use for logging, etc.
- the exit status of the subprocess.
killedProcess
public boolean killedProcess()
Get whether the process was killed.
true
if the process was killed, false otherwise.
run
public void run()
Run this ExecuteJava in a Thread.
setClasspath
public void setClasspath(Path p)
Set the classpath to be used when running the Java class.
p
- an Ant Path object containing the classpath.
setJavaCommand
public void setJavaCommand(Commandline javaCommand)
Set the Java "command" for this ExecuteJava.
javaCommand
- the classname and arguments in a Commandline.
setOutput
public void setOutput(PrintStream out)
since 1.4.x.
manage output at the task level.
Set the stream to which all output (System.out as well as System.err)
will be written.
out
- the PrintStream where output should be sent.
setPermissions
public void setPermissions(Permissions permissions)
Set the permissions for the application run.
permissions
- the Permissions to use.
setSystemProperties
public void setSystemProperties(CommandlineJava.SysProperties s)
Set the system properties to use when running the Java class.
s
- CommandlineJava system properties.
setTimeout
public void setTimeout(Long timeout)
Set the timeout for this ExecuteJava.
timeout
- timeout as Long.
setupCommandLineForVMS
public static void setupCommandLineForVMS(Execute exe,
String[] command)
On VMS platform, we need to create a special java options file
containing the arguments and classpath for the java command.
The special file is supported by the "-V" switch on the VMS JVM.
exe
- the Execute instance to alter.command
- the command-line.