On Fri, Apr 27, 2007 at 10:25:44PM +0800, YU Jiazi wrote:
> My problem is that my SSH client hang on "exit" if I run a java program 
> as a background process.

This will hang:

   ssh somewhere 'sleep 1000 &'

This will not hang:

  ssh somewhere 'sleep 1000 >/dev/null 2>&1 &'

Make sure your program does NOT leave open file descriptors attached to
the terminal, and you should be fine.

> then I save it as Test.java,  and compile, run it as follow in a 
> terminal connected by ssh(my ssh client is putty 0.58):
> 
> javac Test.java
> java -cp . Test &
> exit
> 
> then putty hang, it seems that the SSH connection is still alive and 
> waiting for the java program to exit.

Do this instead:

  java -cp . Test >/dev/null 2>&1 &

Reply via email to