zoukankan      html  css  js  c++  java
  • java 调用linux脚本例子

    public void startTomcat()
        {
            
            String currentPath = ServletActionContext.getServletContext()
                    .getRealPath(File.separator + "WEB-INF" + File.separator);
            String tomcatBin = currentPath.split("webapps")[0] + "bin";
            String[] commands = {"sh", "startup.sh"};
            try
            {
                ProcessBuilder b = new ProcessBuilder(commands);
                b.redirectErrorStream();
                b = b.directory(new File(tomcatBin));
                Process rt = b.start();
                rt.waitFor();
            }
            catch (IOException e)
            {
            }
            catch (InterruptedException e)
            {
                
            }
           
        
        }

  • 相关阅读:
    线程安全
    Thread 的join方法
    守护线程和用户线程
    LinkedList封装
    System.arraycopy的测试
    ArrayList封装
    常用算法
    Java并发---concurrent包
    Java并发--三大性质
    Java并发--final关键字
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3135403.html
Copyright © 2011-2022 走看看