我正在尝试从我的java程序执行数据库备份。数据库位于我的覆盆子pi上,我正从我的笔记本电脑访问它。 每次尝试这样做都会导致以下错误,错误指的是什么文件,是否在我的覆盆子pi中,如果是,我该如何找到它?
欢迎所有建议。
这是我的代码:
void backUpDatabase(){
ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
ses.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
Runtime.getRuntime().exec("mysqldump -h " + connURL +" -u <user> -p <password> <databaseName>"
+ "> <The/local/path/for/the/backup> ");
} catch (IOException ex) {
Logger.getLogger(LogInScreenController.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println("Run");
}
}, 0, 1, TimeUnit.HOURS);
}
错误讯息:
java.io.IOException: Cannot run program "mysqldump": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at login.LogInScreenController$4.run(LogInScreenController.java:544)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at