How to interact with app started from ant?
In the process of building a P2P app for a class, I start a number of peers from an ant build file before starting one in "interactive" mode.

The ant docs on the <java> task states that one can interact with a forked app since ant-1.6.3

The code to read input is:

<pre><code>
while (true) {
				System.out.println("> ");
				BufferedReader br = new BufferedReader(new InputStreamReader(
						System.in));
				String cmd = "";
				try {
					cmd = br.readLine();
					System.out.println(cmd + "hier");
					if (cmd == null)
						continue;
					if (cmd.equals("hello")) {
						System.out.println("Port: ");
						int bsPort = new Integer(br.readLine());
						System.out.println("IP (blank for localhost): ");
						String bsIp = br.readLine();
						if (bsIp.equals(""))
							bsIp = "127.0.0.1";
						bootstrap(bsIp, bsPort);
					}
					else if (cmd.equals("plist")) {
						plist();
					}
					else if (cmd.equals("nlist")) {
						nlist();
					}
					else {
						System.out.println("Command was read as: " + cmd);
					}

				} catch (IOException ioe) {
					System.out.println("IO error trying to read your command!");
					System.exit(1);
				}
</code></pre>

The relevant ant task is:

The ant task can apparently not be shown by SO, but it's basically a java fork="false" block.

Of note is that I run the root and subsequent peers in parallel -> daemons blocks to get them to run in the background. Those are forked.

I have tried with fork="true" and fork="false" (finding a link that said to set it to false) - both to no avail.

I have found one link saying that I can use a TimedBufferedReader, but am a bit wary to do so only to please ant...
How to interact with app started from ant?
===

In the process of building a P2P app for a class, I start a number of peers from an ant build file before starting one in "interactive" mode.

The ant docs on the <java> task states that one can interact with a forked app since ant-1.6.3

The code to read input is:

<pre><code>
while (true) {
				System.out.println("> ");
				BufferedReader br = new BufferedReader(new InputStreamReader(
						System.in));
				String cmd = "";
				try {
					cmd = br.readLine();
					System.out.println(cmd + "hier");
					if (cmd == null)
						continue;
					if (cmd.equals("hello")) {
						System.out.println("Port: ");
						int bsPort = new Integer(br.readLine());
						System.out.println("IP (blank for localhost): ");
						String bsIp = br.readLine();
						if (bsIp.equals(""))
							bsIp = "127.0.0.1";
						bootstrap(bsIp, bsPort);
					}
					else if (cmd.equals("plist")) {
						plist();
					}
					else if (cmd.equals("nlist")) {
						nlist();
					}
					else {
						System.out.println("Command was read as: " + cmd);
					}

				} catch (IOException ioe) {
					System.out.println("IO error trying to read your command!");
					System.exit(1);
				}
</code></pre>

The relevant ant task is:

The ant task can apparently not be shown by SO, but it's basically a java fork="false" block.

Of note is that I run the root and subsequent peers in parallel -> daemons blocks to get them to run in the background. Those are forked.

I have tried with fork="true" and fork="false" (finding a link that said to set it to false) - both to no avail.

I have found one link saying that I can use a TimedBufferedReader, but am a bit wary to do so only to please ant...