+1  A: 

Maybe "When Runtime.exec() won't" can help you.

The reason the command works in a command shell and not in Java might be that the command shell has the advantage of being able to refer to the PATH environment variable to find it; Java cannot. I'll bet if you put the full path to Nmap.exe that you'll fare better.

duffymo
Thanks for the answer ! I read that article many times but couldn't find the answer in there. Unfortunately, I think, the problem is not about that 4 pitfalls.What I don't understand is why the same type of command works with a native program like notepad and doesn't with NMAP. When using Runtime.exec(), windows simply forgets the whereabouts of NMAP. I'm getting a error that says "Windows cannot find 'nmap.exe'. Make sure you typed the name correctly, and then try again". But the same command works with the command prompt.
YargiErel
"I'm getting a error that says "Windows cannot find 'nmap.exe'." - Then the problem is *clearly* that `nmap.exe` cannot be found on the PATH that `cmd.exe` is using when executed via `Process.exec(...)`. Use the full pathname for `nmap.exe` and it should work.
Stephen C
Worked like a charm.. Thanks a lot !
YargiErel