0

I tried to open eclipse with particular workspace using following program but its not working.

Runtime runTime = Runtime.getRuntime();
Process process = runTime.exec("eclipse.exe \"D:\\Research_&_development\"");
Nirav Prajapati
  • 2,987
  • 27
  • 32
taufik
  • 25
  • 6
  • 1
    Take a look at http://stackoverflow.com/questions/209789/starting-eclipse-w-specific-workspace. Maybe that helps. – DirkNM Oct 08 '14 at 11:29

3 Answers3

0

Use -data path to specify the workspace location.

greg-449
  • 109,219
  • 232
  • 102
  • 145
0

Use this code to open eclipse by your code:

  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) {

        }
    }

}
Juhi Saxena
  • 1,197
  • 11
  • 17
0

When you want Eclipse to open a specific workspace from the command line or a shell execution, you can use the -data path\to\workspace argument.

In your case, you can do:

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

However, I recommend using absolute pathways in general; you don't have to, but I allows you to easily locate folders in the future.

Matthew
  • 3
  • 2