Runtime.getRuntime().exec()

Are you familiar with the exec double-quotes bug? (for Runtime.exec or ProcessBuilder)

You can try:

Runtime.getRuntime().exec(new String[] {
  "\"C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump\"", 
  "-h", 
  hostName+user+databaseName});

Just make sure none of your parameters you will have to pass contains double quotes (while not beginning with double quotes)
(see bug 6511002)

Any parameter like:

mykey="my value with space"

would be changed internally (by the getRuntime() implementation) into

"mykey="myvalue with space""

If that is the case, you would need to tokenize the argument:

{"mykey=\"my\"" , "\"value with space\""}

Leave a Comment