File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes exec() and double quotes.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "exec() and double quotes.." Watch "exec() and double quotes.." New topic

exec() and double quotes..

craig sanders

Joined: Sep 20, 2000
Posts: 2
in java for aix i'm run into an interesting problem.. in my servlet i run the following: <edited for length>
sProcess = sPath + "User -create -login " + sEmpID + " -address " + eEmpEmail + " -name \"" + sEmpName + "\"";
Process createUser = Runtime.getRuntime().exec(sProcess);
the java (or servlet engine - WebSphere seems to be stripping off the double quotes that i need around the name above.. any ideas on how to fix this? (without upgrading java -- because WebSphere will supposedly not work w/ a higher version)
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You might try one of the other forms of exec, that take an array of String for the command line parameters. That will eliminate the parsing step which appears to strip the quotes.
I agree. Here's the link:
subject: exec() and double quotes..
jQuery in Action, 3rd edition