Here is some update on the issue.
Actually before it worked on my computer and did not work on my colleague's computer. This weekend I re-installed OS from Win 7 32 bits to Win 7 64 bits and got the same issue. I checked with my colleague and he also has Win 7 64 bits. So looks like the issue is with 64 bits OS.
I'm using ant (exec task) to execute my build command. Executing build command from console works fine. However executing build command from ant leads to the discussed error. So wondering what exactly could cause the issue... Java (64 bits), rhino or ant..