I need to invoke native Processes in a session using
Java.
To summarize the problem, I am using ProcessBuilder class to invoke commands. But challenge is can I invoke subsequent commands in the same session?
i.e. once you have got an instance of Process from ProcessBuilder, we want to execute a series of commands in the same process (session).
Just to explain by this with an example:
Say, we are in C:\
And we execute �dir� command. It will list the directories in C:\
Now we want to execute �cd C:\test� and then do �dir� again so that we get the listing of �C:\test� and not �C:\�
The problem that I am facing with this is that:
- On execution of first command I get the result back in the Process's Inputstream but when I write the second command to the Outputstream of the same process to be executed in the same session, then I do not get the result back in the Process's InputStream.
is there anything that I am doing wrong? Please help me understand this.
Thanks a lot.