Hi friends I'm facing a strange problem,,, as im starting a process thru Runtime.exec(),which return me this Process object ,this process is a server which takes some time to start completely ,now im getting this process input stream thru process.getInputStream() after using Thread.sleep(x)so that my process can be started completely , This works nice on linux(means it gives me complete inputstream) but when i try to execute it on NT it gives me uncomplete inputstream and its vary time to time . can anybody please help me out .. Tx.
Hard to say - I think we need more info. What do you mean exactly by "incomplete input stream"? Is this an exception of some sort which is thrown? Perhaps you should show some of the code which you're using here, and describe exactly what it does which you consider a problem.
sorry man to post my question in two groups . Actually my mean to say "incomplete input stream" is that suppose the Process gives 10 lines of mesg & suppose it takes 2 sec for it & when i try to read it than it give sometime 5 lines ,sometimes 6 lines and sometimes all lines ie it is very uncertain in case of NT (although im using sleep before reading them(mesg)),,,but in case of Linux it alwyas give me all lines of mesg. thanx.
Could you show the code you use to read the input stream? My guess is that you simply aren't reading all the input - you need a loop to guarantee that you keep reading until an end-of-file is reached. For example:
Here the "!= null" causes the program to keep looping and attempting to read lines until the end of output is reached. If you're not doing something like this, that's probably the problem.