如何使用java程序使用指定的工作区打开eclipse

时间:2014-10-08 11:25:16

标签: java eclipse runtime

我尝试使用以下程序使用特定工作区打开eclipse,但它无法正常工作。

Runtime runTime = Runtime.getRuntime();
Process process = runTime.exec("eclipse.exe \"D:\\Research_&_development\"");

3 个答案:

答案 0 :(得分:0)

使用-data path指定工作区位置。

答案 1 :(得分:0)

使用此代码通过代码打开eclipse:

  class openEclipse {
    public static void main(String args[]) {
        try {
            Runtime.getRuntime()
                    .exec("F:\\eclipse-standard-luna-R-win32-x86_64\\eclipse\\eclipse.exe -data D:\\new");
        } catch (Exception e) {

        }
    }

}

答案 2 :(得分:0)

当您希望Eclipse从命令行或shell执行中打开特定工作区时,您可以使用-data path\to\workspace参数。

在您的情况下,您可以这样做:

Runtime runTime = Runtime.getRuntime();
Process process = runTime.exec("eclipse.exe", "-data \"Research_&_development\"");

但是,我建议一般使用绝对路径;你没必要,但我允许你以后轻松找到文件夹。