更改 Linux 中的 .eclipse 文件夹

Change .eclipse folder in Linux

如何更改 Linux 中的 .eclipse 文件夹?我尝试添加这一行:

-Dosgi.configuration.area=/directory/directory1/eclipse/.eclipse

在 eclipse.ini 的顶部,但它不起作用。我也试过将它添加到 eclipse.ini 中的其他各个地方,但仍然没有成功。

编辑

我添加了这一行:

-Dosgi.configuration.area=file:/directory/directory1/eclipse/.eclipse

紧接着 -vmargs。当 Eclipse 启动时,它现在从正确的 .eclipse 位置读取,如果那里不存在 .eclipse,它会创建它。不幸的是,在加载 Eclipse 之后,在我的主文件夹中创建了另一个 .eclipse 文件夹,然后 Eclipse 继续从该文件夹中读取。我怀疑我的 eclipse.ini 文件现在是正确的,但我需要更改另一个文件。

您必须在 -vmargs 行之后的 eclipse.ini 的 end 处放置 属性 定义。如果没有 -vmargs 行,您必须添加一个。

所以:

.... other lines ....
-vmargs
... other arguments
-Dosgi.configuration.area=/directory/directory1/eclipse.eclipse

最简单的做法可能是向 java 传递一个不同的 user.home,这样所有其他无数的位置都基于 user.home。因此,在 .ini 文件中使用它,而不是你所拥有的:

-Duser.home=/directory/other/here

除了 .eclipse 之外,您可能会在覆盖的 user.home 中找到其他目录,例如 .p2.oracle_jre_usage

其他说明:

-Dosgi.configuration.area是Eclipse配置区的变化,不影响用户区。您也可能不想更改默认设置,除非您真的想要多个配置(阅读下面的更多信息)。

此外,通常的做法是使用 -configuration 作为 eclipse{.exe} 的参数,然后让 eclipse 将其转换为适当的 VM 参数。

您可能希望 -user 覆盖用户区域。查看 locations in the Eclipse help 了解更多信息(引用如下)。

但是,仍然有一些东西可以单独控制它们的位置,例如安全存储,它由 -eclipse.keyring command line argument.

控制

Locations

The Eclipse runtime defines a number of locations which give plug-in developers context for reading/storing data and Eclipse users a control over the scope of data sharing and visibility. Eclipse defines the following notions of location:

User (-user) {osgi.user.area} [@none, @noDefault, @user.home, @user.dir, filepath, url] User locations are specific to, go figure, users. Typically the user location is based on the value of the Java user.home system property but this can be overridden. Information such as user scoped preferences and login information may be found in the user location.

Install (-install) {osgi.install.area} [@user.home, @user.dir, filepath, url] An install location is where Eclipse itself is installed. In practice this location is the directory (typically "eclipse") which is the parent of the eclipse.exe being run or the plugins directory containing the org.eclipse.equinox.launcher bundle. This location should be considered read-only to normal users as an install may be shared by many users. It is possible to set the install location and decouple eclipse.exe from the rest of Eclipse.

Configuration (-configuration) {osgi.configuration.area} [@none, @noDefault, @user.home, @user.dir, filepath, url] Configuration locations contain files which identify and manage the (sub)set of an install to run. As such, there may be many configurations per install. Installs may come with a default configuration area but typical startup scenarios involve the runtime attempting to find a more writable configuration location.

Instance (-data) {osgi.instance.area} [@none, @noDefault, @user.home, @user.dir, filepath, url] Instance locations contain user-defined data artifacts. For example, the Resources plug-in uses the instance area as the workspace location and thus the default home for projects. Other plugins are free to write whatever files they like in this location.

While users can set any of these locations, Eclipse will compute reasonable defaults if values are not given. The most common usecase for setting location is the instance area or, in the IDE context, the workspace. To run the default Eclipse configuration on a specific data set you can specify:

eclipse -data c:\mydata