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""}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…