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. 1 for the vm/options and 1 for the classname/arguments. It provides specific methods for a java command line.

Author:
thomas.haas@softwired-inc.com,
Inner Class Summary
static class CommandlineJava.SysProperties
          Specialized Environment class for System properties
 
Constructor Summary
CommandlineJava()
           
 
Method Summary
 void addSysproperty(Environment.Variable sysp)
           
 void clearJavaArgs()
          Clear out the java arguments.
 java.lang.Object clone()
           
 Commandline.Argument createArgument()
           
 Path createClasspath(Project p)
           
 Commandline.Argument createVmArgument()
           
 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)
          -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()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandlineJava

public CommandlineJava()
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:
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)
-mx or -Xmx depending on VM version

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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

restoreSystemProperties

public void restoreSystemProperties()
                             throws BuildException

getSystemProperties

public CommandlineJava.SysProperties getSystemProperties()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

clearJavaArgs

public void clearJavaArgs()
Clear out the java arguments.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.