如何将MySQL55服务器启动到java应用程序中

时间:2015-09-01 12:55:23

标签: java

import java.io.*;

public class Clasa {

    public static void main(String args[]) {

        try {
            Runtime rt = Runtime.getRuntime();

            String comand = "net start MySQL55";
            Process pr = rt.exec(" cmd.exe /C " + "net start MySQL55");

            BufferedReader input = new BufferedReader(
                    new InputStreamReader(pr.getInputStream()));

            String line = null;

            while ((line = input.readLine()) != null) {
                System.out.println(line);
            }

            int exitVal = pr.waitFor();
            System.out.println("Exited with error code " + exitVal);

        } catch (Exception e) {
            System.out.println(e.toString());
            e.printStackTrace();
        }
    }
}

我试试这个并给我下一个错误代码:Exited with error code 2

0 个答案:

没有答案