zoukankan      html  css  js  c++  java
  • Runtime.getRuntime().exec学习记录[转贴]

    原帖:http://chenyaqiong81081.blog.163.com/blog/static/44622594200791235256255/

    一、Runtime.getRuntime().exec()执行命令情况:
           Runtime.getRuntime().exec("cmd /c your command")//2000
           Runtime.getRuntime().exec("command /c your command")//98
           Runtime.getRuntime().exec("sh/ your command")//linux

    二、执行.sh文件的情况:
          1、把命令写成a.sh ;执行命令的时候
               Process child = Runtime.getRuntime().exec("bash a.sh,null,new File("//usr/local/mysql/bin/"));
               child.waitFor();
               ........
           2、Process child = Runtime.getRuntime().

                                              exec(new String[] {"/bin/sh","-c","mysqldump -u root -p7788919 axtic_cg" },

                                                       null,
                                                       new File("/usr/local/mysql/bin/"));
                child.waitFor();

                注:waitFor()等待操作完成


     

  • 相关阅读:
    搜索部分学习小结
    递归与搜索部分知识点小结
    匿名函数
    监督学习和非监督学习
    单变量线性回归
    神经网络(2)
    html
    javascript
    win10+celery4.x以上+redis的天坑
    Django-Views
  • 原文地址:https://www.cnblogs.com/chen1987lei/p/1895616.html
Copyright © 2011-2022 走看看