Runtime.getRuntime().exec() question

hey all

i need some help in the exec() method

i am trying to run the following

try{

Runtime.getRuntime().exec("mysqldump --user=user --password=password dvd > c:\\dvd.sql");

}catch (IOException e1){

JOptionPane.showMessageDialog(null

,"error, backup failed"

,"ERROR"

, JOptionPane.ERROR_MESSAGE);

}

when this code runs , a file called dvd.sql should be created in the c: directory but nothings happen...

please help

thanks in advance

[804 byte] By [bif_fa] at [2007-11-27 7:55:41]
# 1

1) Supply the full path to the mysqldump executable.

2) The redirection symbol ( > ) is processed by the command shell (or whatever it's called in Windows). It's not understood at the level that Runtime.exec interacts with. I would assume mysqldump lets you specify a file with a -something or --something argument. If not, you'll have to invoke cmd.exe and tell it to run "mysqldump ... > whatever"

It's something like rt.exec("cmd /c mysqldump blah blah ... > ...");

The unix equivalent would be like rt.exec("/bin/bash -c '/usr/local/bin/mysqldump blah blah > whatever'");

3) Read this. (It's probably not related to this particular problem, but it's good to know.)

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

jverda at 2007-7-12 19:37:06 > top of Java-index,Java Essentials,Java Programming...