Calling "mysqldump" with Runtime.getRuntime().exec(cmd) from Windows 7

2014-07-22T20:50:59

I am trying to dump a MySQL database within my Java application the following way:

String[] command = new String[] {"cmd.exe", "/c", "C:/mysql/mysqldump.exe" --quick --lock-tables --user=\"root\" --password=\"mypwd\" mydatabase > \"C:/mydump.sql\""};
Process process = Runtime.getRuntime().exec(command);
int exitcode = process.waitFor();

The process fails with exit-code 6. I somewhere read that the operand ">" is not correctly interpreted and there was the hint to use "cmd.exe /c" as prefix. But it still doesn't work.

Any ideas?

Copyright License:
Author:「salocinx」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/24887927/calling-mysqldump-with-runtime-getruntime-execcmd-from-windows-7

About “Calling "mysqldump" with Runtime.getRuntime().exec(cmd) from Windows 7” questions

Does anyone know how I could use quickblox to make a voice calling/video calling? I'm making this app when the user clicks on the phone icon it starts the voice call between users and when they cli...
I have a thread running in my application. Inside the thread I am waiting on an auto reset event to exit. I want to make sure that i close the handle of the event after i use it. Ihave two options.
Can we call layoutIfNeeded if we are not calling setNeedsLayout . [self.contentView setNeedsLayout]; [self.contentView layoutIfNeeded]; Is there any benefit of calling layoutIfNeeded, if deve...
What is the difference between calling super and calling super()? Which is the best one if the arguments passed to the child method don’t match what the parent is expecting.
I have some problem with my singleton and UIViewController there; Singleton.h @property (nonatomic, retain) UIViewController *viewController; Singleton.m ... @synthesize viewController =
Calling a RESTful web service means POST/GET some values to the web service URL. When calling a SOAP web service, does it also POST the value to the web service URL (with the value following the ...
I often see code like this: X::y()->z(); Is this a static object calling a method y, the result of y returning an object, and this object then calling a method called z? Thank you.
I was working on a VOIP app two days ago and was successful in implementing a normal App to App calling using Sinch. The app is working fine. When I started I saw in their docs that they supported
After calling setTimeout, is there memory leak issue without calling clearTimeout? Thanks.
If calling PQFinish, which "closes the connection to the server", is there any benefit to calling PQCancel beforehand? i.e. if the connection is closed, would the PostgreSQL server cancel...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.