How to install the latest version of Eclipse Classic on Ubuntu 12.04 using the terminal?

走远了吗. 提交于 2019-12-05 02:46:43
Mark Hillick

See this blog post here, for step-by-step instructions.

The process is documented step-by-step and in the comments the author has included a script -

#!/bin/sh

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_indigo/enabled=true
repositories/http\:__download.eclipse.org_releases_indigo/isSystem=false
repositories/http\:__download.eclipse.org_releases_indigo/nickname=Indigo Update Site
repositories/http\:__download.eclipse.org_releases_indigo/uri=http\://download.eclipse.org/releases/indigo/
EOF

}

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

exec $ECLIPSE "$@"

which works.

krizna

Step 1 » Install java JDK or JRE

sudo apt-get install openjdk-7-jdk

Step 2 » Download latest copy from here http://www.eclipse.org/downloads/?osType=linux

Step 3 » Move the downloaded package to /opt directory

sudo mv eclipse-SDK-4.2.2-linux-gtk.tar.gz /opt

Step 4 » Extract the package

sudo tar -xvf /opt/eclipse-SDK-4.2.2-linux-gtk.tar.gz -C /opt

Step 5 » Create a new desktop file eclipse.desktop in /usr/share/applications/ and add the below lines .

[Desktop Entry]
Name=Eclipse 
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=eclipse.desktop

Step 6 » Simply drag this eclipse.desktop file to the launcher.

Check this link : install eclipse in ubuntu 12.04

Make sure to cd to the /opt folder before executing the tar command. If you don't then the tar command will create the eclipse directory in whatever your current directory is.

After installing java JDK or JRE run the following command and it'll install eclipse for you,

sudo apt-get install eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!