Google

CommandlineJava (Apache Ant API)

org.apache.tools.ant.types
Class CommandlineJava


java.lang.Object

  |

  +--org.apache.tools.ant.types.CommandlineJava

All Implemented Interfaces:
java.lang.Cloneable

public class CommandlineJava
extends java.lang.Object
implements java.lang.Cloneable

A representation of a Java command line that is nothing more than a composite of 2 Commandline. One is used for the vm/options and one for the classname/arguments. It provides specific methods for a java command line.

Author:
thomas.haas@softwired-inc.com
, Stephane Bailliez

Nested Class Summary
static class CommandlineJava.SysProperties
          Specialized Environment class for System properties
 
Constructor Summary
CommandlineJava()
          constructor uses the VM we are running on now.
 
Method Summary
 void addSysproperty(Environment.Variable sysp)
           
 void clearJavaArgs()
          Clear out the java arguments.
 java.lang.Object clone()
          clone the object; do a deep clone of all fields in the class
 Commandline.Argument createArgument()
           
 Path createClasspath(Project p)
           
 Commandline.Argument createVmArgument()
           
 java.lang.String describeCommand()
          Returns a String that describes the command and arguments suitable for verbose output before a call to Runtime.exec(String[])
 java.lang.String describeJavaCommand()
          Returns a String that describes the java command and arguments for in VM executions.
 java.lang.String getClassname()
           
 Path getClasspath()
           
 java.lang.String[] getCommandline()
          get the command line to run a java vm.
 java.lang.String getJar()
           
 Commandline getJavaCommand()
           
 CommandlineJava.SysProperties getSystemProperties()
           
 Commandline getVmCommand()
           
 java.lang.String getVmversion()
           
 void restoreSystemProperties()
           
 void setClassname(java.lang.String classname)
          set the classname to execute
 void setJar(java.lang.String jarpathname)
          set a jar file to execute via the -jar option.
 void setMaxmemory(java.lang.String max)
          Specify max memory of the JVM -mx or -Xmx depending on VM version
 void setSystemProperties()
           
 void setVm(java.lang.String vm)
           
 void setVmversion(java.lang.String value)
           
 int size()
          The size of the java command line.
 java.lang.String toString()
          get a string description
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandlineJava


public CommandlineJava()
constructor uses the VM we are running on now.

Method Detail

createArgument


public Commandline.Argument createArgument()

createVmArgument


public Commandline.Argument createVmArgument()

addSysproperty


public void addSysproperty(Environment.Variable sysp)

setVm


public void setVm(java.lang.String vm)

setVmversion


public void setVmversion(java.lang.String value)

setJar


public void setJar(java.lang.String jarpathname)
set a jar file to execute via the -jar option.

Parameters:
jarpathname - the pathname of the jar to execute

getJar


public java.lang.String getJar()
Returns:
the pathname of the jar file to run via -jar option or null if there is no jar to run.
See Also:
getClassname()

setClassname


public void setClassname(java.lang.String classname)
set the classname to execute

Parameters:
classname - the fully qualified classname.

getClassname


public java.lang.String getClassname()
Returns:
the name of the class to run or null if there is no class.
See Also:
getJar()

createClasspath


public Path createClasspath(Project p)

getVmversion


public java.lang.String getVmversion()

getCommandline


public java.lang.String[] getCommandline()
get the command line to run a java vm.

Returns:
the list of all arguments necessary to run the vm.

setMaxmemory


public void setMaxmemory(java.lang.String max)
Specify max memory of the JVM -mx or -Xmx depending on VM version


toString


public java.lang.String toString()
get a string description

Overrides:
toString in class java.lang.Object
Returns:
the command line as a string

describeCommand


public java.lang.String describeCommand()
Returns a String that describes the command and arguments suitable for verbose output before a call to Runtime.exec(String[])

Since:
Ant 1.5

describeJavaCommand


public java.lang.String describeJavaCommand()
Returns a String that describes the java command and arguments for in VM executions.

The class name is the executable in this context.

Since:
Ant 1.5

size


public int size()
The size of the java command line.

Returns:
the total number of arguments in the java command line.
See Also:
getCommandline()

getJavaCommand


public Commandline getJavaCommand()

getVmCommand


public Commandline getVmCommand()

getClasspath


public Path getClasspath()

setSystemProperties


public void setSystemProperties()
                         throws BuildException
BuildException

restoreSystemProperties


public void restoreSystemProperties()
                             throws BuildException
BuildException

getSystemProperties


public CommandlineJava.SysProperties getSystemProperties()

clone


public java.lang.Object clone()
clone the object; do a deep clone of all fields in the class

Overrides:
clone in class java.lang.Object
Returns:
a CommandlineJava object

clearJavaArgs


public void clearJavaArgs()
Clear out the java arguments.



Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.