使用特定工作区启动 Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/209789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:29:04  来源:igfitidea点击:

Starting Eclipse w/ Specific Workspace

eclipsezend-studioeclipse-pdt

提问by Wilco

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

有没有办法启动 eclipse 的实例,向它传递某种参数,告诉它使用特定的工作区?

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.

我要解决的问题是,我有一个用于工作项目的工作区和一个用于个人项目的工作区。我希望能够将这些与工作区联系起来,以单独启动我可以独立启动的快捷方式。

回答by Matt H

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

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

您还可以使用 UNIX 样式的相对路径名,例如

-data ../workspace

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

即使在 Windows 下,万一参数中不喜欢冒号或反斜杠,例如 Jumplist Launcher

回答by Anson Smith

With the -data switch

使用 -data 开关

Setting a specific location for the workspace with -data

使用 -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.

要使用 -data 命令行参数,只需将 -data your_workspace_location(例如,-data c:\users\robert\myworkspace)添加到快捷方式属性中的 Target 字段,或将其明确包含在命令行中。

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

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

回答by ThisClark

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.

我们通过修改快捷方式属性为高中学生设置默认工作区。在这种情况下,我们运行的是 Windows 7 环境。默认工作区位于映射为 H: 驱动器的学生网络共享上,因此我们添加了-data h:\workspace。屏幕截图显示了确切位置。

enter image description here

在此处输入图片说明

回答by santaranger

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

请注意,您可以使用 UNIX 样式的相对路径名,例如

-data ../workspace

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

即使在 Windows 下,万一参数中不喜欢冒号或反斜杠,例如 Jumplist Launcher

回答by DGolberg

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 Projects2and 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.

老问题,我知道,但只是想指出您可能需要在目标工作区路径周围添加引号。例如; 我试过了C:\Eclipse\eclipse.exe -data E:\Eclipse Projects2,它会打开一个空白的默认工作区,同时C:\Eclipse\eclipse.exe -data "E:\Eclipse Projects2"允许它使用现有的工作区。我猜这会因操作系统和/或 Eclipse 版本而异,但我不确定到底是什么因素影响了这一点,所以只需尝试两种方式,直到您可以加载正确/现有的工作区。

回答by Pramod

Creating a shortcut file with target :

使用 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 :

从 .bat 文件启动:

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"

回答by Mrinal

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

来自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.areaJVM arg as -Dosgi.instance.area=../workspace

也可以使用osgi.instance.areaJVM arg指定工作空间位置作为-Dosgi.instance.area=../workspace

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

这可以在 eclipse.ini 文件中与现有/其他 JVM 参数一起指定,例如-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.

对于那些只想附加到 eclipse.ini 文件(它已经包含其他 JVM 参数)而不担心确保 JVM 参数出现在最后的人来说,此选项可能很方便。

回答by user3560541

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.

此命令将使用指定的工作区打开 eclipse。这是一个工作示例。