如何从java代码运行ij工具

时间:2016-05-26 15:32:43

标签: java apache batch-file derby java-io

我尝试运行derby的* .bat文件,但我不能这样做。

我想运行" startNetworkServer.bat"和" ij.bat"使用java代码。 我尝试编写一些简单的代码,但它不起作用。

package dbconnect;

import java.io.IOException;

public class RunDerbyTools {

    public static void main(String[] args) {

        String pathIj, pathStartNetwork, pathStopNetwork;

        pathIj = "C:/MyWorkSpace/MyDBProject/db/bin/ij.bat"; // running ij tool

        // running network
        pathStartNetwork = "C:/MyWorkSpace/MyDBProject/db/bin/startNetworkServer.bat";

        // stop network
        pathStopNetwork = "C:/MyWorkSpace/MyDBProject/db/bin/stopNetworkServer.bat";

        try {
            Process pStartNetwork = Runtime.getRuntime().exec(pathStartNetwork);

        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            Process pPathIj = Runtime.getRuntime().exec(pathStartNetwork);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

需要帮助! 谢谢!

0 个答案:

没有答案