使用特定工作区启动 Eclipse
有没有办法启动 Eclipse 实例,向其传递某种参数,告诉它使用特定的工作空间?
我试图解决的问题是我有一个用于工作项目的工作空间和一个用于个人项目的工作空间。 我希望能够将它们与工作区绑定到可以独立启动的单独快捷方式。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
来自 http://help.eclipse。 org/help21/topic/org.eclipse.platform.doc.user/tasks/running_eclipse.htm:
使用以下命令行参数:
例如,
您还可以使用 UNIX 风格的相对路径名,例如
甚至在 Windows 下,以防参数中不喜欢冒号或反斜杠,例如 Jumplist Launcher
From http://help.eclipse.org/help21/topic/org.eclipse.platform.doc.user/tasks/running_eclipse.htm:
Use the following command-line argument:
For example,
you can also use UNIX-style relative path names such as
even under Windows, in case something doesnt like colons or backslashes in parameters, like Jumplist Launcher
使用 -data 开关
使用 -data 设置工作区的特定位置
要使用 -data 命令行参数,只需将 -data your_workspace_location(例如 -data c:\users\robert\myworkspace)添加到快捷方式属性,或将其显式包含在命令行中。
来自: http: //help.eclipse.org/help21/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm
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
我们通过修改快捷方式属性为高中学生设置默认工作区。 本例中,我们运行的是Windows 7环境。 默认工作区位于映射为 H: 驱动器的学生网络共享上,因此我们添加了-data h:\workspace。 屏幕截图显示了具体位置。
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.
请注意,您可以使用 UNIX 风格的相对路径名,甚至
在 Windows 下,以防参数中不喜欢冒号或反斜杠,例如 Jumplist Launcher
note that you can use UNIX-style relative path names such as
even under Windows, in case something doesn't like colons or backslashes in parameters, like Jumplist Launcher
老问题,我知道,但只是想指出您可能需要在目标工作空间路径周围添加引号。 例如; 我尝试了 C:\Eclipse\eclipse.exe -data E:\Eclipse Projects2 ,它会在执行
C:\Eclipse\eclipse.exe -data " 时打开一个空白的默认工作区E:\Eclipse Projects2"
允许它使用现有的工作空间。 我猜这会根据操作系统和/或 Eclipse 版本而有所不同,但我不确定具体是什么因素,所以请尝试两种方法,直到找到一种方法来加载正确/现有的工作区。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 doingC:\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.使用目标创建快捷方式文件:
创建 Eclipse 的快捷方式。
打开快捷方式文件的属性并设置目标,如下所示,
从 .bat 文件启动:
示例:
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,
For launching from .bat file :
Example:
我希望人们能给出一个实际的例子,我通过例子而不是语法学得更好。
所以就这样...
这个命令将使用指定的工作空间打开 eclipse。 这是一个工作示例。
I wish people would give an actual example, i learn better with examples rather than syntax.
so here it goes...
this command will open eclipse with the specified workspace. this is a working example.
来自 https://help .eclipse.org/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html
也可以使用 osgi.instance.area< 指定工作空间位置/code> JVM arg as
-Dosgi.instance.area=../workspace
这可以在 eclipse.ini 文件中与现有/其他 JVM 参数(例如
-Xms、-Xmx
)一起指定。对于那些只想附加到 eclipse.ini 文件(已包含其他 JVM 参数)而不必担心确保 JVM 参数出现在末尾的人来说,此选项可能很方便。
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.
此外,从桌面快捷方式中,通过将 -data“工作区目录路径”添加到目标末尾,将在 Eclipse 特定工作区中打开您的项目。
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.