Could someone please help me with how to get Unix command output in my JSP file? I am able to execute a unix command from JSP. However, I need to display the output in my JSP and I am not able to do it. This is what I am doing in my JSP -
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.
You can go back and change your post to add code tags by clicking the button on your post.
Consider yourself lucky. Apparently your process' buffer has not been filled yet. If it writes more to its output stream the buffer will be filled, and because you do not clear it until after the call to waitFor() that call will then block indefinitely. Read the article William linked to, really.
As Rob pointed out the fact that it worked once means only that you got lucky on the size of the Process output buffer. Also, if for some reason the process writes to the stdErr stream the program will likely hang indefinately.
Thank you for the link to article. It was pretty good.
Bill, on process hanging for infinite time if it writes to stdErr, that doesn't happen. I tested it and all I had to do was instead of getting inputStream get errorStream to process error response. So one block for input stream and one block for error stream.