Greetings,
I'm having problems running java from within a shell script. The java
application mostly runs, but I've noticed that it does not receive a
^C interrupt and it cannot read from stdin when invoked this way.
Typing "java ..." directly at my bash prompt does not demonstrate
this problem. Any ideas?
I'm running Linux kernel 2.0.36 (RedHat 5.2) with Blackdown's JDK
1.1.7_v1a. The following little class demonstrates the problem...
import java.io.*;
class input
{
public static void main(String[] argv)
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
while (true) {
String line = in.readLine();
if (line == null) break;
System.out.println(line);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
And here's a simple shell script...
#!/bin/sh
java -classpath $CLASSPATH input