eclipse 移动eclipse的默认配置文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8223489/
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-19 17:21:09  来源:igfitidea点击:

Move default config folder of eclipse

eclipseide

提问by Damior

When Eclipse first start, it creates some config files and folders on my hard drive (contains information about work-space ...etc...). I don't like the position it creates config files because config files are all put in my C:\Users\Long folder and that's ugly. I want to put all those config files somewhere else (C:\Eclipse\ for example). This happens in Linux too.

当 Eclipse 首次启动时,它会在我的硬盘驱动器上创建一些配置文件和文件夹(包含有关工作空间的信息......等......)。我不喜欢它创建配置文件的位置,因为配置文件都放在我的 C:\Users\Long 文件夹中,这很难看。我想将所有这些配置文件放在其他地方(例如 C:\Eclipse\)。这也发生在 Linux 中。

Do you know how to put those files in somewhere else?

您知道如何将这些文件放在其他地方吗?

回答by Damior

Just add the following to your eclipse.inifile (found at the root eclipse installation folder):

只需将以下内容添加到您的eclipse.ini文件中(在根 eclipse 安装文件夹中找到):

-Dosgi.configuration.area=file:/C:/Workspace/.eclipse 

回答by ?nderson Soares

To change the default .eclipse folder location, go to ${eclipse.home}, open your eclipse.ini with a text editor and insert there one line more:

要更改默认的 .eclipse 文件夹位置,请转到 ${eclipse.home},使用文本编辑器打开 eclipse.ini 并在其中再插入一行:

-Dosgi.configuration.area=/path_to_new_folder_location/.eclipse/

-Dosgi.configuration.area=/path_to_new_folder_location/.eclipse/

回答by рüффп

As other said, adding the property -Dosgi.configuration.areain the eclipse.inifile does the trick.

正如其他人所说,-Dosgi.configuration.areaeclipse.ini文件中添加属性可以解决问题。

But in my opinion it would be better to rely on the user.home variable and set the destination like for the other variables.

但在我看来,最好依靠 user.home 变量并像其他变量一样设置目的地。

Example with -Dosgi.instance.area.default:

示例-Dosgi.instance.area.default

[email protected]/eclipse-workspace

In my case I just wanted another destination than the default @user.home/.eclipsewhich was used by the Eclipse Mars I still uses for old project and I defined:

在我的情况下,我只想要另一个目的地而不是@user.home/.eclipseEclipse Mars 使用的默认目的地,我仍然用于旧项目,我定义了:

[email protected]/.eclipse-oygen-3

to have a specific destination for Eclipse Oxygen 3 installation.

为 Eclipse Oxygen 3 安装指定一个特定的目的地。

Note that syntax works for both Windows and Linux (I did not tested on OSX, but I guess it should).

请注意,该语法适用于 Windows 和 Linux(我没有在 OSX 上测试过,但我想应该可以)。

回答by mliebelt

Eclipse has some command line argumentsyou can use. One of those arguments is the flag -datawhich tells Eclipse where the workspace of Eclipse should be located.

Eclipse 有一些您可以使用的命令行参数。其中一个参数是标志-data,它告诉 Eclipse Eclipse 的工作空间应位于何处。

So when I create a new workspace, I normally create a shortcut under Windows (or script file under Linux) with the following contents:

所以当我新建一个工作区时,我一般会在Windows下(或者Linux下的脚本文件)创建一个快捷方式,内容如下:

eclipse.exe -vm <JDK>\bin\javaw.exe" -data ws -nl en

This defines which JDK should be used, that the workspace is located under wsand that the english locale should be used.

这定义了应使用哪个 JDK、工作区位于其下ws以及应使用英语语言环境。

回答by GigaGo

IMHO parameter -configurationdoes the trick. It must point to a subdirectory named "config". Eclipse will fill this and the upper directory itself with files, e.g. for a JBoss server installation.

恕我直言参数-构型的伎俩。它必须指向名为“config”的子目录。Eclipse 将使用文件填充此目录和上层目录本身,例如用于 JBoss 服务器安装。

If you have more than one eclipse installation, then you should use a different directory for each eclipse installation.

如果您有多个 eclipse 安装,那么您应该为每个 eclipse 安装使用不同的目录。

Example how to keep everything in defined places:

示例如何将所有内容保存在定义的位置:

"C:\Program Files (x86)\eclipse\eclipse48jee\eclipse.exe" -nl en_US -vm "C:\Program Files (x86)\Java\jdk1.8.0_212\bin" -configuration C:\EclipseData\eclipse48jee\config-data C:\Workspaces\SomeProject

"C:\Program Files (x86)\eclipse\eclipse48jee\eclipse.exe" -nl en_US -vm "C:\Program Files (x86)\Java\jdk1.8.0_212\bin" -configuration C:\EclipseData\eclipse48jee \config-data C:\Workspaces\SomeProject