title: How to display system.out (in console) on ant?
body: <p>I am able to build java program on ant and it has been configured properly. However i'm wondering how would i see System.out.println / System.out.print on console using Ant ? </p>
  
  <p><strong>Note:</strong> i haven't used ant and i am trying to explore. I hope my question is not stupid ?</p>
  
  <p>Simple program</p>
  
  <pre><code>    package antTesting;
      public class Helloworld
      {
  
          /**
           * @param args
           */
          public static void main( String[] args )
          {
              System.out.println( " hello there !!!! " );
  
          }
  
      }
  </code></pre>
  
  <p>build.xml for the same</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="Ant-Test" default="main" basedir="."&gt;
    &lt;!-- Sets variables which can later be used. --&gt;
    &lt;!-- The value of a property is accessed via ${} --&gt;
    &lt;property name="src.dir" location="src" /&gt;
    &lt;property name="build.dir" location="build" /&gt;
    &lt;property name="dist.dir" location="dist" /&gt;
    &lt;property name="docs.dir" location="docs" /&gt;
  
    &lt;!-- Deletes the existing build, docs and dist directory--&gt;
    &lt;target name="clean"&gt;
      &lt;delete dir="${build.dir}" /&gt;
      &lt;delete dir="${docs.dir}" /&gt;
      &lt;delete dir="${dist.dir}" /&gt;
    &lt;/target&gt;
  
    &lt;!-- Creates the  build, docs and dist directory--&gt;
    &lt;target name="makedir"&gt;
      &lt;mkdir dir="${build.dir}" /&gt;
      &lt;mkdir dir="${docs.dir}" /&gt;
      &lt;mkdir dir="${dist.dir}" /&gt;
    &lt;/target&gt;
  
    &lt;!-- Compiles the java code (including the usage of library for JUnit --&gt;
    &lt;target name="compile" depends="clean, makedir"&gt;
      &lt;javac srcdir="${src.dir}" destdir="${build.dir}"&gt;
      &lt;/javac&gt;
  
    &lt;/target&gt;
  
    &lt;!-- Creates Javadoc --&gt;
    &lt;target name="docs" depends="compile"&gt;
      &lt;javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}"&gt;
        &lt;!-- Define which files / directory should get included, we include all --&gt;
         &lt;fileset dir="${src.dir}"&gt;
                  &lt;include name="**" /&gt;
             &lt;/fileset&gt;
      &lt;/javadoc&gt;
    &lt;/target&gt;
  
    &lt;!--Creates the deployable jar file  --&gt;
    &lt;target name="jar" depends="compile"&gt;
      &lt;jar destfile="${dist.dir}\de.vogella.build.test.ant.jar" basedir="${build.dir}"&gt;
        &lt;manifest&gt;
          &lt;attribute name="Main-Class" value="test.Main" /&gt;
        &lt;/manifest&gt;
      &lt;/jar&gt;
    &lt;/target&gt;
  
    &lt;target name="main" depends="compile, jar, docs"&gt;
      &lt;description&gt;Main target&lt;/description&gt;
    &lt;/target&gt;
  
  &lt;/project&gt; 
  </code></pre>
  
  <p>when i <code>run &gt; ant</code> </p>
  
  <p>on CMD</p>
  
  <pre><code>Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
  Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~2\HP\Sprinter\
  bin\JAVA_S~1\classes;C:\PROGRA~2\HP\Sprinter\bin\JAVA_S~1\classes\jasmine.jar
  Buildfile: C:\Users\ms025226\workspace\TestingWorld\build.xml
  
  clean:
     [delete] Deleting directory C:\Users\ms025226\workspace\TestingWorld\build
     [delete] Deleting directory C:\Users\ms025226\workspace\TestingWorld\docs
     [delete] Deleting directory C:\Users\ms025226\workspace\TestingWorld\dist
  
  makedir:
      [mkdir] Created dir: C:\Users\ms025226\workspace\TestingWorld\build
      [mkdir] Created dir: C:\Users\ms025226\workspace\TestingWorld\docs
      [mkdir] Created dir: C:\Users\ms025226\workspace\TestingWorld\dist
  
  compile:
      [javac] C:\Users\ms025226\workspace\TestingWorld\build.xml:26: warning: 'inc
  ludeantruntime' was not set, defaulting to build.sysclasspath=last; set to false
   for repeatable builds
      [javac] Compiling 1 source file to C:\Users\ms025226\workspace\TestingWorld\
  build
  
  jar:
        [jar] Building jar: C:\Users\ms025226\workspace\TestingWorld\dist\de.vogel
  la.build.test.ant.jar
  
  docs:
    [javadoc] Generating Javadoc
    [javadoc] Javadoc execution
    [javadoc] Loading source file C:\Users\ms025226\workspace\TestingWorld\src\Hel
  loworld.java...
    [javadoc] Constructing Javadoc information...
    [javadoc] Standard Doclet version 1.6.0_31
    [javadoc] Building tree for all the packages and classes...
    [javadoc] Building index for all the packages and classes...
    [javadoc] Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
    [javadoc] Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~2\
  HP\Sprinter\bin\JAVA_S~1\classes;C:\PROGRA~2\HP\Sprinter\bin\JAVA_S~1\classes\ja
  smine.jar
    [javadoc] Building index for all classes...
  
  main:
  
  BUILD SUCCESSFUL
  Total time: 2 seconds
  </code></pre>
  
  <p>When i defined <strong>target for classpath</strong> i am receiving an error</p>
  
  <pre><code>&lt;!-- to printoutputs --&gt;    
    &lt;target name="Helloworld" description="Hello world"&gt;
          &lt;java classname="antTesting.Helloworld"&gt;
              &lt;arg value="arg1"/&gt;
              &lt;arg value="arg2"/&gt;         
          &lt;/java&gt;
   &lt;/target&gt;
  
    &lt;target name="main" depends="compile, jar, docs, Helloworld"&gt;
      &lt;description&gt;Main target&lt;/description&gt;
    &lt;/target&gt;
  </code></pre>
  
  <p><strong>ERROR:</strong></p>
  
  <pre><code>Helloworld:
       [java] Could not find antTesting.Helloworld. Make sure you have it in your classpath
       [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:138)
       [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
       [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
       [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
       [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
       [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
       [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       [java]     at java.lang.reflect.Method.invoke(Method.java:597)
       [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
       [java]     at org.apache.tools.ant.Task.perform(Task.java:348)
       [java]     at org.apache.tools.ant.Target.execute(Target.java:357)
       [java]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
       [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
       [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
       [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
       [java]     at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
       [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
       [java]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
       [java]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
       [java] Java Result: -1
  </code></pre>