1. 下载jdk 地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. 解压文件 tar -zxvf jdk-8u121-linux-x64.tar.gz -C /opt/jvm #解压文件到/opt/jvm中,/opt内保存公开源应用程序
3. 在/etc/profile中配置环境变量:
sudo gedit /etc/profile
#环境变量用冒号(:)隔开,不是分号(;)
export JAVA_HOME=/opt/jvm/jdk1.8.0_121
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
检测安装完成
java -version
w@A:/opt/jvm$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14,mixed mode)
4.下载eclipse 地址: http://www.eclipse.org/downloads/eclipse-packages/
5.解压 tar -zxvf eclipse-jee-neon-2-linux-gtk-x86_64.tar.gz -C /opt/eclipse
6.创建桌面图标
sudo touch eclipse.desktop
sudo gedit eclipse.desktop
输入文本:
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse
Exec=/opt/eclipse/eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;
保存并添加权限:
sudo chmod +x eclipse.desktop