Sure, empty catch block is the bad point to find error.
Also, you are running "C:/Programme.exe"
have you any executables with such name?
Joined: Jan 22, 2009
I have printStacktrace() in catch block and file path is fine...it's soething else i think
Joined: Dec 24, 2008
Sasika, would you like to trick us posting code which has no relation to you real problem?
with you posted code we have next:
rt.exec("C:/Programme Files/MySQL/MySQL Server 5.0/bin/mysqldump -u uname -ppassword databaseName>C:/backup.sql");
Yes, Runtime.exec(String) is much better than Runtime.exec(String). It saves you from all the trouble about paths containing spaces and parameters needing to be quoted.
Also be sure to handle the input/error/output stream of the child process. This is described in detail in the article "When Runtime.exec() won't" by Daconta. Nobody should use Runtime.exec without reading that.
Sasika Thiranga wrote:C:/Programme Files/MySQL/MySQL Server 5.0/bin/mysqldump -u uname -ppassword databaseName>C:/backup.sql
1) shouldn't there be a space between -p and password?
2) file redirection like this (using > C:/backup.sql) is handled by the shell (cmd.exe), it is not part of the application. To do the same in Java you would need to get the process' output (through getInputStream()) and copy its contents to a FileOutputStream("C:/backup.sql") manually. This would also solve half of the problems that the article Ulf mentioned is about. (You'll still need to clear getErrorStream().)