17

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?

smci
  • 32,567
  • 20
  • 113
  • 146
Cameron Wetzel
  • 195
  • 1
  • 1
  • 10
  • Do you want to install for multi-user, or do you merely want to customize the install dir (or perms) for a single user? The former implies moving the `~/.p2` ("bundle pool") tree somewhere more sensible. – smci Dec 04 '17 at 19:54

5 Answers5

12

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.

Zoltán Ujhelyi
  • 13,788
  • 2
  • 32
  • 37
  • Today (21.5.2021) Eclipse installer on macOS Big Sur fails to install if the users home director is not at /Users/username. Even though I specified the install location the installer still insist on writing some files into /Users/username/.p2 – nyholku May 21 '21 at 13:09
1

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

smci
  • 32,567
  • 20
  • 113
  • 146
XavierStuvw
  • 1,294
  • 2
  • 15
  • 30
1

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.

mjn
  • 403
  • 5
  • 7
1

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.

LJHW
  • 355
  • 3
  • 15
  • This worked for me though I did have to click "Set Current Pool Bundle" after adding a new agent. Also, for me the $HOME/.p2 agent keeps coming back. This makes a small about is disk space get used in $HOME. I guess if you never run the eclipse-inst again, then they won't come back. – aerobiotic Nov 11 '21 at 16:59
0

assumed, that eclipse is 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 -vmargs insert: -Duser.home=.\myDATA (take care that -Duser.home is overwritten later in the ini-file!) - restart eclipse

now you can copy eclipse wherever you want.

Martin
  • 506
  • 1
  • 5
  • 12