Uhm... srry if there's anything strange with how I word things since it's my first time asking in a site like this. There's still a lot of things that I don't really understand but I'll do my best to try and elaborate my problem.
New to Apache Ant, I tried following the steps for running a basic program from the Apache manual, configuring it a bit to try of a different code. Basically, using ant compile, ant jar, and ant run works out just fine.
Following the build.xml setup provided, I tried to do something like a yes-no user input which seemed to turn out okay.
Build.xml
<project>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile">
<javac srcdir="src" destdir="classes" />
</target>
<target name="jar">
<jar destfile="build/jar/Circle.jar" basedir="classes">
<manifest>
<attribute name="Main-Class" value="Circle"/>
</manifest>
</jar>
</target>
<target name="input">
<input message="Do you want to show the details of a Circle?" validargs="y,n" addproperty="do.delete"/>
<condition property="do.abort">
<equals arg1="n" arg2="${do.delete}"/>
</condition>
<fail if="do.abort">Build aborted by user.</fail>
</target>
<target name="run" depends="input">
<java classname="Circle" fork="true">
<classpath path="classes" />
</java>
</target>
Circle.java
import java.lang.*;
public class Circle{
public static void main(String[] args){
int radius;
double circumference;
double areaOfCircle;
radius=10;
circumference =2* 3.1416*radius;
areaOfCircle = 3.1416 * radius *radius;
System.out.println();
System.out.println("********************************************************");
System.out.println("* Radius of circle is " + radius +" *");
System.out.println("* Circumference of circle is " + circumference +" *");
System.out.println("* Area of circle is " + areaOfCircle +" *");
System.out.println("********************************************************");
}
}
How do I configure it so that I can put a selection statement asking for user input in the source code? Something like removing the input target in the buildfile and putting "Do you want to show the details of a Circle?" in the Circle file.