Reputation:
I have a .java file and am compiling it using javac in ant. The .class file goes to output directory. A.class when ran, produces a.txt.
How to run the ant ´java´ task and where will the a.txt go, when ran? I mean which directory? Can I specify the direc. where the output files of java task should go?
Upvotes: 0
Views: 2352
Reputation: 63734
Take a look at this for reference:
http://ant.apache.org/manual/Tasks/java.html
It contains an example of using the Java task to run a specific class, e.g:
<target name="run">
<java classname="A">
<classpath>
<pathelement location="output"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
It really depends on where you are writing the file out to from A.java. If it is in the current directory, e.g:
File f = new File("./test.txt");
f.createNewFile();
then it will output the file relative to where you ran the build file from.
Hope that helps.
Upvotes: 4