Java error: a-1 (EOF) in Linux

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.

Java error: a-1 (EOF) in Linux

Postby Saadi » Wed Apr 09, 2003 8:36 pm

I have a question from one of the groups that are testing their application on one of our Redhat boxes. Could someone pls. review and provide some insight?


Issue running a java program. The program issues a:

int cmd;

while (true)
{
try{
cmd = System.in.read();
}catch(Exception e){
}

System.out.println("Read a command");
}

call. The call continuously returns a -1 (end of file). It only happens when I run the program FROM within a .sh file and have the program started up in the background. Any thoughts. It probably has something to do with a background process starting from a shell script is not getting assigned an input stream and the read call thinks it reached EOF, but it is only happening under Linux. So, any thoughts?

Your helpful tips would be highly valuable.

Thanks,
--Saadi
Aziz Khawaja
Chicago, Il.
Saadi
Lance Naik
 
Posts: 33
Joined: Thu Mar 06, 2003 11:06 pm
Location: Chicago, Il - USA

Return to “%s” Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron