I tested the following code using Ant 1.8.2 on Ubuntu Linux 12.04, as well as on Windows 7. On both operating systems, a blank line was printed, as shown in the following figure.
JavaTest.java
public class JavaTest { public static void main(String[] args) { System.out.println("Hello"); System.out.println(""); System.out.println("World"); } }
Inside build.xml
<target name="java-test" depends="compile"> <java classpath="${classes.dir}" classname="JavaTest" fork="true" failonerror="true" /> </target>
Output
$ ant java-test Buildfile: /home/my/project/build.xml java-test: [java] Hello [java] [java] World BUILD SUCCESSFUL Total time: 2 seconds
source share