This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 12761
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..
Similar Threads
WebSphere 6.1.07 bug in forward jsp:param tag?
generally Servlet problem
Controlling Windows Services from a Java App
Create table error
Compilation problem in Windows Command Prompt