How to pass values containing spaces using Runtime.exec(command)?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Richard_Blum
Posted On:   Monday, October 22, 2001 05:12 PM

I am using Runtime.exec(command) to send commands to an application (Macromedia Generator). The format is
generate fileName -param var1 value1 -param var2 value2 ...
This works except when there are spaces inside of a var. Putting quotes around the var do not work, neither single quotes nor double quotes. Is there a way to send commands with values which contain spaces?

Re: How to pass values containing spaces using Runtime.exec(command)?

Posted By:   Nathan_Meyers  
Posted On:   Tuesday, October 23, 2001 08:55 AM

Use the Runtime.exec(String[]) form of the method:



Runtime.getRuntime().exec(new String[] {"generate", "filename", "-param", ...});

This is what Java does under the covers after separating the arguments to Runtime.exec(String) by finding the spaces.

About | Sitemap | Contact