This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I think you need to read this classic article on the nuances of Runtime.exec()
Its a little old article and now its suggested to use ProcessBuilder but still you would have a lot to learn from that article.
In your case, i am not sure do you need to run "start" also. start will start a new dos prompt but all the other commands will still be executed in the process started using Runtime.exec(), so you would not see the result of your cd commands in the new dos prompt.
"The current directory" is a concept that applies to one specific executing process. When you use Runtime.exec() to execute a CMD.EXE, which in turn executes the "CD" command, that one specific executing process is the CMD.EXE shell. In other words, your code is working; "CD" is executed, and it changes the current directory of that CMD.EXE, which promptly exits.
Now, surely you've heard the old puzzle about the tree falling in the forest? This is like that. If you change the current directory of a process that then quits right away, does that effect anything? And the answer is no, of course.
Now, on to your next question: no, there's no other way to change the current directory of the executing JVM. It is what it is.
If you're trying to set the current directory for some other program that you're going to execute later, then you can create a batch file, and put the cd command and the command to run the other program into that batch file, and then Runtime.exec() the batch file.
i am also facing this problem but i use cmd for 'FFMPEG' in webapplication. i can't mention the path of 'cmd.exe'
how can solve it .. otherwise i mention my ffmpag.exe path directely to first argument... please provide right way..