1.在官网上下载eclipse压缩包,我下载的是eclipse-cpp-oxygen-R-linux-gtk.tar.gz,
解压:tar xzvf eclipse-cpp-oxygen-R-linux-gtk.tar.gz
2.我的ubuntu已经安装好了java,通过java -version命令查看java
lin@ubuntu:~$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11)
OpenJDK Server VM (build 25.131-b11, mixed mode)
一般java的安装目录为/usr/lib/jvm
3.在eclipse.ini文件开头添加
-vm
/usr/lib/jvm/java-8-openjdk-i386/jre/bin/java
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.500.v20170531-1133
4. 用vim打开/etc/profile,在文件最后面加上环境变量
#
PATH=$PATH:/usr/lib/jvm/java-8-openjdk-i386/jre/bin
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386/jre/
export CLASSPATH=$JAVA_HOME/lib
注:添加的路径请根据自己电脑的路径