+1  A: 

You need to use a threadsafe data structure; I don't think LinkedList is threadsafe.

Jason S
I have updated the code to synchronize. It still has the same issue. :\
Banana
+1  A: 

One mistake that strikes me is that LinkedList is not synchronized, but you're trying to write to it in 2 threads.

Another thing to keep in mind is Process.getInputStream() returns the stdout stream of the process, so you should rename the variable currently called stdin to stdout to prevent confusion.

oksayt
yeah, I got confused by the use of "stdin". From your Java program's point of view, it's an input stream, but from the Process's point of view it's stdout.
Jason S
I have changed stdin to stdout along with adding synchronization.
Banana
+1  A: 

There are known bugs in pre-Vista Windows operating systems where loading DLLs can cause a hang in IO.

e.g. see http://weblogs.java.net/blog/kohsuke/archive/2009/09/28/reading-stdin-may-cause-your-jvm-hang and https://connect.microsoft.com/VisualStudio/feedback/details/94701/loadlibrary-deadlocks-with-a-pipe-read

I'm not sure if this is what you are running in to, but it may be related.

Also, I vaguely recall some issues in getting a valid stdin and stdout from non-console windows applications. If your call to 'test.jar' is using 'javaw' rather than 'java', then this could be the cause of your problem, too.

Burleigh Bear
Oh, I just used test.jar as an example. That is good to know, though.
Banana