一、准备工作
1.1 进入/opt并新建文件夹jvm
cd /opt
sudo mkdir jvm
1.2 在jvm中下载jdk-8u112-linux-x64.tar.gz 和 eclipse-cpp-neon-3-linux-gtk-x86_64
wget http://mirrors.linuxeye.com/jdk/jdk-8u112-linux-x64.tar.gz
wgethttp://ftp.yz.yamagata-u.ac.jp/pub/eclipse/technology/epp/downloads/release/neon/3/eclipse-cpp-neon-3-linux-gtk-x86_64.tar.gz
二、开始安装
2.1 解压 jdk
tar zxvf jdk1.8.0_112
2.2 配置jdk环境变量
打开profile:
sudo gedit /etc/profile
在最后添加:
export JAVA_HOME=/opt/jvm/jdk1.8.0_112
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
保存,退出,然后source一下(我建议重启一下)
source /etc/profile
检查一下是否安装成功:
java -version
2.3 解压安装eclipse
sudotar zxvf eclipse-cpp-neon-3-linux-gtk-x86_64.tar.gz
使用把jdk1.8.0_112中的jre文件夹复制一份到eclipse中
wnw@wnw:/opt/jvm$ sudo cp -r jdk1.8.0_112/jre eclipse
然后进入eclipse文件夹中,输入./eclipse就能运行它了
三、创建图标
3.1 进入/usr/share/applications,并新建一个文件eclipse.desktop
cd /usr/share/applications
gksudo toucheclipse.desktop
3.2 然后编辑这个文件:
gksudo gedit eclipse.desktop
输入以下内容:
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/jvm/eclipse/eclipse
Terminal=false
Icon=/opt/jvm/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
Name=Eclipse
Type=Application
Exec=/opt/jvm/eclipse/eclipse
Terminal=false
Icon=/opt/jvm/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
保存,退出
然后就可以在应用中搜索到Eclipse了