9

请问如何使用终端在 Ubuntu 12.04 上安装最新的 Eclipse Classic (4.2)?如果您能一步一步指导我,我将不胜感激。

4

4 回答 4

20

步骤 1 »安装 java JDK 或 JRE

sudo apt-get install openjdk-7-jdk

第 2 步 »从此处下载最新副本 http://www.eclipse.org/downloads/?osType=linux

步骤 3 »将下载的包移动到 /opt 目录

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

第 4 步 »解压缩包

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

第 5 步 »/usr/share/applications/中创建一个新的桌面文件eclipse.desktop并添加以下行。

[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

第 6 步 »只需将此eclipse.desktop文件拖到启动器。

检查此链接:在 ubuntu 12.04 中安装 eclipse

于 2013-05-20T07:48:05.017 回答
8

有关分步说明,请参阅此处的此博客文章。

该过程已逐步记录在案,并且作者在评论中包含了一个脚本-

#!/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 "$@"

哪个有效。

于 2012-08-17T10:25:27.133 回答
0

确保在执行 tar 命令之前 cd 到 /opt 文件夹。如果您不这样做,那么 tar 命令将在您当前的目录中创建 eclipse 目录。

于 2014-03-14T14:28:05.387 回答
0

安装 java JDK 或 JRE 后运行以下命令,它将为您安装 eclipse,

sudo apt-get install eclipse

于 2014-12-03T01:02:55.010 回答