转载自http://my.oschina.net/u/1407116/blog/227084 http://my.oschina.net/u/1407116/blog/227087
一 JDK的安装
1、下载JDK
从官网下载jdk8 jdk-8u5-linux-x64.tar.gz
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2、解压
$ tar -zxvf jdk-8u5-linux-x64.tar.gz
解压出来是一个jdk1.8.0_05文件夹
3、将文件夹移动到安装目录
$ sudo mv jdk1.8.0_05 /usr/local/
4、配置环境变量 ,更改/etc/profile文件
sudo gedit /etc/profile
在文件最后加上如下几行:
export JAVA_HOME=/usr/local/jdk1.8.0_05
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
5、更改默认配置选项 ,依次执行如下命令
sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_05/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_05/bin/javac 300
i add next:
sudo update-alternatives --install /usr/bin/jar jar /usr/local/jdk1.8.0_05/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/local/jdk1.8.0_05/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/local/jdk1.8.0_05/bin/javap 300
2 安装eclipse
2、下载eclipse
从官网http://www.eclipse.org/downloads/下载Eclipse IDE for Java EE Developers的Linux版本 eclipse-SDK-3.7.2-linux-gtk.tar.gz
3、解压
$ tar -zxvf eclipse-SDK-3.7.2-linux-gtk.tar.gz
解压出来是一个eclipse文件夹
4、将文件夹移动到安装目录
$ sudo mv eclipse /usr/local/
5、启动eclipse
$ /usr/local/eclipse/eclipse
6、创建桌面链接
$ sudo su
# gedit /usr/share/applications/eclipse.desktop
写入以下内容
[Desktop Entry]
Name=Eclipse
Comment=Eclipse SDK
Encoding=UTF-8
Exec=/usr/local/eclipse/eclipse
Icon=/usr/local/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Application;Development;
完成后可以在Application-Programming下看到eclipse图标。