Ubuntu – Install Eclipse 4.1 manually

eclipsesoftware installation

I am using Ubuntu 11.04 and once installed Eclipse 3.5.2 via software center.
Now I plan to make an upgrade to 4.1, so I downloaded the *.tar.gz file from here. I replaced the contents in /usr/lib/eclipse and now it's time to modify the start-up script /usr/bin/eclipse, which I am not familiar with, such as the dependency and the setting, coded in the file. Can anyone tell me how to rewrite those parts? Thank you.

The script is as follows:

!/bin/sh

# work around for e#290395 / LP: #458703
# https://bugs.eclipse.org/bugs/show_bug.cgi?id=290395
# https://bugs.launchpad.net/bugs/458703
export GDK_NATIVE_WINDOWS=true

export MOZILLA_FIVE_HOME="/usr/lib/xulrunner-$(/usr/bin/xulrunner-1.9.2--gre-version)"

ECLIPSE=/usr/lib/eclipse/eclipse

inject_update_site(){
    if [ ! -e "$1" ] ; then
    echo "W: Cannot find $1" 2>&1
    return 1
    fi
    cat - >>"$1" <<EOF
repositories/http\:__download.eclipse.org_releases_galileo/enabled=true
repositories/http\:__download.eclipse.org_releases_galileo/isSystem=false
repositories/http\:__download.eclipse.org_releases_galileo/nickname=Galileo
Update Site
repositories/http\:__download.eclipse.org_releases_galileo/uri=http\://download.eclipse.org/releases/galileo/
EOF

}


if [ ! -d ~/.eclipse/ ] ; then
    $ECLIPSE -clean -initialize || exit $?
    settings=`echo
~/.eclipse/org.eclipse.platform_*/p2/org.eclipse.equinox.p2.engine/profileRegistry/PlatformProfile.profile/.data/.settings/`
    if [ ! -d "$settings" ] ; then
    echo "W: Cannot inject update-sites, cannot find the correct config." 2>&1
    else
    ( inject_update_site
"$settings/org.eclipse.equinox.p2.metadata.repository.prefs" && \
      inject_update_site
"$settings/org.eclipse.equinox.p2.artifact.repository.prefs" && \
      echo "I: Injected update sites" ) || echo "W: Could not inject updatesites." 2>&1
    fi
fi

exec $ECLIPSE "$@"

Best Answer

(strictly speaking not an answer to the question, but a suggestion how to install eclipse manually)

You should not change files in directories maintained by the package manager. The package manager keeps records about the files it installed. If the files are no longer there, or changed, then the package manager might refuse to continue working. Another problem might be when the package manager tries to upgrade the eclipse package, it might overwrite your files.

I suggest you install your own eclipse to /opt, or ~/opt, or any other directory not maintained by the package manager. You can then place a symlink in ~/bin pointing to your-eclipse-dir/eclipse.

Example:

$ mkdir -p ~/opt
$ cd ~/opt
# download or copy the eclipse tarball here
$ tar xzf eclipse-something.tar.gz
$ cd eclipse
$ ./eclipse # verify that eclipse works
$ cd ~/bin
$ ln -s ~/opt/eclipse/eclipse

Now you can start eclipse by typing eclipse. The symlink in ~/bin should shadow the eclipse executable /usr/bin/eclipse. If not, make sure that ~/bin is in $PATH and located before /usr/bin.

You can check which eclipse you are executing by using which:

$ which eclipse
/home/lesmana/bin/eclipse