为 Eclipse 的 .p2 树使用不同的位置(“捆绑池”)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37864572/
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
Using Different Location for Eclipse's .p2 tree ("bundle pool")
提问by Cameron Wetzel
I currently am trying to set up Eclipse to run from /opt/eclipse.
我目前正在尝试将 Eclipse 设置为从 /opt/eclipse 运行。
Everything was going fine; I extract the software using the Eclipse installer to /opt/eclipse; I made a soft link to it in my /usr/bin directory so I could just type 'eclipse' to run it from anywhere in my user terminal and I thought I was done until this happened:
一切都很顺利;我使用 Eclipse 安装程序将软件解压到 /opt/eclipse;我在我的 /usr/bin 目录中做了一个软链接,这样我就可以在我的用户终端的任何地方输入“eclipse”来运行它,我以为我已经完成了,直到发生这种情况:
$ eclipse /root/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444: cannot open shared object file: Permission denied Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
$ eclipse /root/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444:无法打开共享对象文件:权限被拒绝Gtk-消息:GtkDialog在没有临时父级的情况下映射. 这是不鼓励的。
After some exploring in the /opt/eclipse/eclipse.ini and /opt/eclipse/configuration/config.ini files I came to the conclusion that when I installed Eclipse using the installer under super user permission that it installed the necessary libraries under /root directory.
在 /opt/eclipse/eclipse.ini 和 /opt/eclipse/configuration/config.ini 文件中进行了一些探索后,我得出的结论是,当我在超级用户权限下使用安装程序安装 Eclipse 时,它在 / 下安装了必要的库根目录。
I can use 'sudo eclipse' and it works but it becomes a hassle to have to enter my password every time. I am thinking of copying the .p2 file under /usr/lib to "generalize" it and allow access from any pwd as my user; would this be a smart idea or should I be doing something else?
我可以使用“sudo eclipse”并且它可以工作,但是每次都必须输入密码变得很麻烦。我正在考虑复制 /usr/lib 下的 .p2 文件以“概括”它并允许以我的用户身份从任何密码访问;这是一个聪明的主意还是我应该做其他事情?
采纳答案by Zoltán Ujhelyi
The .p2 folder is a shared installation folder that is referenced by all the Eclipse instances created by the installer. Sadly, I don't think it is safe to move the existing version (I might be wrong, but I am not sure how many times it is referenced), but you can create a new one.
.p2 文件夹是由安装程序创建的所有 Eclipse 实例引用的共享安装文件夹。遗憾的是,我认为移动现有版本并不安全(我可能错了,但我不确定它被引用了多少次),但您可以创建一个新版本。
The concept the installer is using here is called 'Bundle pool', and you can set up as many locations for that as you like. To open the bundle pool settings, find the corresponding item in the installer UI.
安装程序在这里使用的概念称为“捆绑池”,您可以根据需要为其设置任意数量的位置。要打开捆绑池设置,请在安装程序 UI 中找到相应的项目。
In case of the simple UI, press the menu bottom on the top (1), and then select Bundle pools...:
在简单 UI 的情况下,按顶部的菜单底部 (1),然后选择 Bundle pools...:
If you are using the advanced UI, there is an dropdown list at the bottom of the first page of the wizard with the list of existing bundle pools. By clicking the button next to it, you can get to the bundle pool manager.
如果您使用的是高级 UI,则向导第一页底部有一个下拉列表,其中包含现有包池列表。通过单击它旁边的按钮,您可以进入捆绑池管理器。
In both cases, in the presented dialog you can create your own bundle pool which you can put into any folder you want and then use it as a source of installation.
在这两种情况下,在显示的对话框中,您可以创建自己的捆绑池,您可以将其放入任何您想要的文件夹中,然后将其用作安装源。
Finally, if you have moved all your installations to this new pool, you can safely remove your original bundle pool folder, it will not be required anymore.
最后,如果您已将所有安装移至此新池,则可以安全地删除原始捆绑池文件夹,不再需要它。
回答by XavierStuvw
Say that I am user me
.
说我是用户me
。
- Before installation, change the ownership of
/opt/eclipse
withsudo chown -R me:me /etc/eclipse
so I can launch theenvince-installer
without sudo rights. - Install into
/opt/eclipse
in simple mode. No folder on/root/.p2
gets created. The.p2
tree is installed into my home directory (but as shown in the other answeryou can customize this too) - After installation, revert the ownership of
/etc/eclipse
withsudo chown -R root:root /etc/eclipse
. Now I can start the executable under/opt/eclipse
without sudo rights since there's no need to access/root
. - I make an alias and even an item in the launcher menu to start eclipse from the desktop environment.
- 在安装之前,更改
/opt/eclipse
with的所有权,sudo chown -R me:me /etc/eclipse
以便我可以在envince-installer
没有 sudo 权限的情况下启动。 /opt/eclipse
以简单模式安装。没有/root/.p2
创建文件夹。该.p2
树安装到我的主目录中(但如其他答案所示,您也可以自定义它)- 安装后,恢复
/etc/eclipse
with的所有权sudo chown -R root:root /etc/eclipse
。现在我可以在/opt/eclipse
没有 sudo 权限的情况下启动可执行文件,因为不需要访问/root
. - 我在启动器菜单中创建了一个别名甚至一个项目,以从桌面环境启动 eclipse。
My specifications: Ubuntu 14.04 LTS, Java SE Runtime Environment build 1.8.0_111-b14, Eclipse Installer 1.6.0 Build 2790, Eclipse Neon
我的规格:Ubuntu 14.04 LTS、Java SE Runtime Environment build 1.8.0_111-b14、Eclipse Installer 1.6.0 Build 2790、Eclipse Neon
回答by mjn
I ran into the same issue (home directory was getting huge) and did a hack:
我遇到了同样的问题(主目录越来越大)并做了一个黑客:
$ mv ~/.p2 /opt/eclipse/p2
$ ln -s /opt/eclipse/p2 ~/.p2
The eclipse installer (... and eclipse itself) seems happy with the symlink and the "pool" information now is hosted in the /opt/eclipse area and sucks up disk space over there.
eclipse 安装程序(...和 eclipse 本身)似乎对符号链接很满意,“池”信息现在托管在 /opt/eclipse 区域中,并占用了那里的磁盘空间。
You mayhave to get some superuser privs to do the first move, but it does work with open permissions and multiple users adding symlinks to the same area.
您可能需要获得一些超级用户权限才能执行第一步,但它确实适用于开放权限和多个用户向同一区域添加符号链接。
回答by Martin
assumed, that eclipseis the folder, where your portable eclipse is installed in: - shut down eclipse - create a folder under eclipse (i.e. myDATA) - edit eclipse\eclipse.ini- under the entry -vmargsinsert: -Duser.home=.\myDATA(take care that -Duser.homeis overwritten later in the ini-file!) - restart eclipse
假定,认为日食是文件夹,其中便携式日食被安装在: -关闭日食- eclipse下创建一个文件夹(即MYDATA) -编辑日食\的eclipse.ini-条目下-vmargs插入:-Duser.home = .\myDATA(注意-Duser.home稍后会在 ini 文件中被覆盖!) - 重新启动 eclipse
now you can copy eclipse wherever you want.
现在你可以在任何你想要的地方复制 eclipse。
回答by LJHW
Having had the same type of problems, I think there should be more explanation on the actual installer. However, similar to the above, this is what I did to get an install that could be used by a non-root user, and store everything 'eclipse' the same place.
遇到相同类型的问题,我认为应该对实际安装程序进行更多解释。但是,与上述类似,这就是我为获得可由非 root 用户使用的安装并将所有“eclipse”存储在同一位置所做的工作。
1) Clear up the mess created by initial experimentation:
1) 清除最初实验造成的混乱:
- Delete these folders from /root : .p2, .eclipse, eclipse
- Delete the unzipped installer
- Delete whatever was installed in /root/
- 从 /root 中删除这些文件夹:.p2、.eclipse、eclipse
- 删除解压后的安装程序
- 删除 /root/ 中安装的任何内容
2) Create the following folders:
2)创建以下文件夹:
- /opt/eclipse
- /opt/eclipse/installer (unzip your installer here)
- /opt/eclipse/pools
- /opt/eclipse/install
- /选择/日食
- /opt/eclipse/installer(在此处解压缩您的安装程序)
- /选择/日食/池
- /选择/日食/安装
Run the installer as sudo. Select Advanced install option on the GUI and add a new pool agent in the /opt/eclipse/pools folder. Select install folder to be /opt/eclipse/install. After installation delete any newly created folders '.p2', '.eclipse', 'eclipse' in /root.
以 sudo 身份运行安装程序。在 GUI 上选择高级安装选项并在 /opt/eclipse/pools 文件夹中添加一个新的池代理。选择安装文件夹为/opt/eclipse/install。安装后删除/root 中所有新创建的文件夹“.p2”、“.eclipse”、“eclipse”。
The executable is now /opt/eclipse/install/eclipse/eclipse and can be started by a non-root user. Also, you can install new packages e.g. PyDev as a non-root user.
可执行文件现在是 /opt/eclipse/install/eclipse/eclipse 并且可以由非 root 用户启动。此外,您可以以非 root 用户身份安装新软件包,例如 PyDev。