Java runtime cannot generate sql file by executing mysqldump command.

problem description

String [] str = {

        "mysqldump -h localhost -u root -p -t lailr_js_pay wx_sp > f:/test.sql"
        ,"root"
    };

Runtime.getRuntime (str) .exec executes the mysqldump command to generate the sql file
but if it is not used, it will report an error
Exception in thread "main" java.io.IOException: Cannot run program "mysqldump-h localhost-u root-p-t lailr_js_pay wx_sp > f:/wx1.sql": the CreateProcess error=2, system cannot find the specified file.

at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at com.test.Test.main(Test.java:18)

the Caused by: java.io.IOException: CreateProcess error=2, system cannot find the specified file.

at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 4 more

Apr.07,2021
The

error is obvious. If you can't find the mysqldump program, try writing an absolute path


running cmd, not mysqldump,
"mysqldump-h localhost-u root-p-t lailr_js_pay wx_sp > f:/test.sql"
this sentence is the parameter of cmd

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b364e8-2bff7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b364e8-2bff7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?