Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Different Location for Eclipse's .p2 tree ("bundle pool")

I currently am trying to set up Eclipse to run from /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 /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.

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.

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?

like image 496
Cameron Wetzel Avatar asked Jun 16 '16 16:06

Cameron Wetzel


People also ask

What is an Eclipse bundle pool?

Eclipse's p2 technology supports the concept of a bundle pool. Bundle pools help to dramatically reduce disk footprint and to eliminate repeated downloads of the same bundles and features, thereby dramatically improving the performance of software updates and target platform provisioning.

What is the. p2 directory?

The . p2 folder is apparently for the Eclipse installer.

Can we install multiple Eclipse on Windows 10?

Multiple Eclipse windows, same workspaceTo open multiple Eclipse windows using the same workspace, select Window→ New Window. It's a good idea to use this technique if you want to work in two different perspectives (such as the Java and Debug perspectives) at the same time in different windows.

What is. p2 folder Eclipse?

An agent is identified by its location on disk. Inside your Eclipse install you will see a p2/ folder, this is the agent for your IDE.


4 Answers

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.

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.

In case of the simple UI, press the menu bottom on the top (1), and then select Bundle pools...: Bundle Pool setting with simple UI

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. Bundle Pool setting with the Advanced 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.

like image 83
Zoltán Ujhelyi Avatar answered Sep 20 '22 12:09

Zoltán Ujhelyi


Say that I am user me.

  • Before installation, change the ownership of /opt/eclipse with sudo chown -R me:me /etc/eclipse so I can launch the envince-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 answer you can customize this too)
  • After installation, revert the ownership of /etc/eclipse with sudo 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.

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

like image 35
XavierStuvw Avatar answered Sep 18 '22 12:09

XavierStuvw


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.

You may have 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.

like image 32
mjn Avatar answered Sep 18 '22 12:09

mjn


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.

1) Clear up the mess created by initial experimentation:

  • Delete these folders from /root : .p2, .eclipse, eclipse
  • Delete the unzipped installer
  • Delete whatever was installed in /root/

2) Create the following folders:

  • /opt/eclipse
  • /opt/eclipse/installer (unzip your installer here)
  • /opt/eclipse/pools
  • /opt/eclipse/install

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.

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.

like image 30
LJHW Avatar answered Sep 19 '22 12:09

LJHW