This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "exec() and double quotes.." Watch "exec() and double quotes.." New topic
Author

exec() and double quotes..

craig sanders
Greenhorn

Joined: Sep 20, 2000
Posts: 2
in java 1.1.8.7 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 3.0.2.2) 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)
-cs
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
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.
Bill

Java Resources at www.wbrogden.com
 
jQuery in Action, 2nd edition
 
subject: exec() and double quotes..
 
Similar Threads
generally Servlet problem
Compilation problem in Windows Command Prompt
WebSphere 6.1.07 bug in forward jsp:param tag?
Controlling Windows Services from a Java App
Create table error