String FileName="MyDBFile";
Process p = Runtime.getRuntime().exec("C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysqldump -uroot -p*password* *Database Name* -r \"D:\\Backupu\\"+FileName+".sql"); // *password* කියන තැනට password එකයි *Database Name* කියන තැනට Database Name එකේ නමයි දෙන්න ඕනෙ.
try {
p.waitFor();
} catch (InterruptedException ex) {
//Exception code
}