java.io.IOException:Cannot run program "mysql -uroot -pbbc123": error=2, No such file or directory 50
java.io.IOException:Cannotrunprogram"mysql-uroot-pbbc123":error=2,Nosuchfileordirecto...
java.io.IOException: Cannot run program "mysql -uroot -pbbc123": error=2, No such file or directory
需求是在linux上运行.sql文件 可是为什么报错,网上都是这样写的,以下是我写的java代码 求解答!!!!
InputStream in = null;
try {
Process pro = Runtime.getRuntime().exec(new String[]{"mysql -uroot -pbbc123","use databases", "source /usr/mysql_sql/customer.sql"});
pro.waitFor();
in = pro.getInputStream();
BufferedReader read = new BufferedReader(new InputStreamReader(in));
String result = read.readLine();
System.out.println("INFO:"+result);
} catch (Exception e) {
e.printStackTrace();
System.out.println("出问题了!!!!!!!!!!!!");
} 展开
需求是在linux上运行.sql文件 可是为什么报错,网上都是这样写的,以下是我写的java代码 求解答!!!!
InputStream in = null;
try {
Process pro = Runtime.getRuntime().exec(new String[]{"mysql -uroot -pbbc123","use databases", "source /usr/mysql_sql/customer.sql"});
pro.waitFor();
in = pro.getInputStream();
BufferedReader read = new BufferedReader(new InputStreamReader(in));
String result = read.readLine();
System.out.println("INFO:"+result);
} catch (Exception e) {
e.printStackTrace();
System.out.println("出问题了!!!!!!!!!!!!");
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询