Starting Eclipse w/ Specific Workspace
Asked Answered
M

9

174

Is there a way to start an instance of eclipse, passing it some sort of parameter telling it to use a specific workspace?

The problem I'm trying to solve is that I have a workspace for work projects and one for personal projects. I'd like to be able to tie these to workspaces to separate shortcuts that I could launch independently.

Mcnary answered 16/10, 2008 at 18:51 Comment(0)
W
265

From http://help.eclipse.org/help21/topic/org.eclipse.platform.doc.user/tasks/running_eclipse.htm:

Use the following command-line argument:

-data your_workspace_location

For example,

-data c:\users\robert\myworkspace

you can also use UNIX-style relative path names such as

-data ../workspace

even under Windows, in case something doesnt like colons or backslashes in parameters, like Jumplist Launcher

Welt answered 16/10, 2008 at 18:54 Comment(2)
Although this answer is 5 years old, I'd like to add since it shows up as a top search result. The thing is that if you add VM arguments in the command line as well like -vmargs -Xms128m -Xmx512m, make sure they come AFTER the data argument else you'll get an error during launch.Lundin
Now, how do you add this option on a Mac desktop shortcut...?Antithesis
P
20

With the -data switch

Setting a specific location for the workspace with -data

To use the -data command line argument, simply add -data your_workspace_location (for example, -data c:\users\robert\myworkspace) to the Target field in the shortcut properties, or include it explicitly on your command line.

From: http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm

Puddling answered 16/10, 2008 at 18:56 Comment(0)
A
20

We set the default workspace for students at a high school by modifying the shortcut properties. In this case, we operate a Windows 7 environment. The default workspace is on a student's network share mapped as the H: drive so we added -data h:\workspace. The screenshot shows exactly where.

enter image description here

Adaxial answered 15/8, 2014 at 18:15 Comment(0)
E
10

note that you can use UNIX-style relative path names such as

-data ../workspace

even under Windows, in case something doesn't like colons or backslashes in parameters, like Jumplist Launcher

Ezekielezell answered 8/5, 2012 at 22:21 Comment(0)
L
3

Old question, I know, but just wanted to point out that you may need to add quotes around the target workspace path. For example; I tried C:\Eclipse\eclipse.exe -data E:\Eclipse Projects2 and it would open a blank, default, workspace while doing C:\Eclipse\eclipse.exe -data "E:\Eclipse Projects2" allowed it to use the existing workspace. I'm guessing this varies based on OS and/or Eclipse version, but I'm not sure exactly what factors into this, so just try both ways until you get one to load the correct/existing workspace.

Lavona answered 27/5, 2015 at 16:3 Comment(1)
Old comment, but the reason of why you need to put your workspace location within quotes is because you have a space in the name. All paths with a space needs to be within quotes to be interpreted correctly. if you exclude the quotes the path will be interpreted as E:\Eclipse and Projects2 will be sent as a new argument to eclipse.Cartogram
D
1

Creating a shortcut file with target :

Create a shortcut of your eclipse. Open the properties of the shortcut file and set the target as follows,

E\STS.exe -data "WORKSPACE_LOCATION"

For launching from .bat file :

cd ECLIPSE_LOCATION   
start STS.exe -data "WORKSPACE_LOCATION"

Example:

cd /D D:\IDE\sts-bundle\sts-3.7.0.RELEASE    
start STS.exe -data "D:\My Workspace\workspace1"
Doubleganger answered 9/10, 2019 at 13:1 Comment(0)
D
0

I wish people would give an actual example, i learn better with examples rather than syntax. so here it goes...

"C:\MyEclipse Blue Edition\MyEclipse Blue Edition 10\myeclipse-blue.exe" -showlocation -data "C:\EclipseWork\WorkSpace"

this command will open eclipse with the specified workspace. this is a working example.

Dhow answered 22/4, 2014 at 13:3 Comment(0)
E
0

From https://help.eclipse.org/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html

It is also possible to specify the workspace location using the osgi.instance.area JVM arg as -Dosgi.instance.area=../workspace

This can be specified in the eclipse.ini file along with existing/other JVM args such as -Xms, -Xmx.

This option may be convenient for those who just want to append to the eclipse.ini file (which already contains other JVM args) without worrying to ensure that JVM args appear at the end.

Evolution answered 12/9, 2017 at 17:58 Comment(0)
C
0

Additionally, from a desktop shortcut, by adding -data "workspace directory path" to the end of your target will open your project in a eclipse specific workspace.

Checked answered 14/12, 2022 at 14:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.