从 http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neon2 下载 eclipse-cpp-neon-2-linux-gtk-x86_64.tar.gz,解压安装至目录 /opt/,运行 /opt/eclipse/eclipse,报错:

JVM terminated. Exit code=1
/usr/bin/java
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /opt/eclipse//plugins/org.eclipse.platform_4.6.2.v20161124-1400/splash.bmp
-launcher /opt/eclipse/eclipse
-name Eclipse
--launcher.library /opt/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.401.v20161122-1740/eclipse_1618.so
-startup /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
--launcher.appendVmargs
-exitdata f0007
-product org.eclipse.epp.package.cpp.product
-vm /usr/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar 

 

看起来是需要 java 1.8。

查看java版本:

$ java -version

java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-2~deb8u1)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)

查查是哪里的java命令:

$ which java
/usr/bin/java
$ ll /usr/bin/java
lrwxrwxrwx 1 root root 22 Jan 25 01:37 /usr/bin/java -> /etc/alternatives/java
$ ll /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Jan 27 15:36 /etc/alternatives/java -> /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java

 

上网搜索/etc/alternatives/java,找到 http://unix.stackexchange.com/questions/100732/i-deleted-etc-alternatives-java,根据其中的说法,执行以下命令以切换至1.8版:

$ sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

本质上它完成的任务是:

ln -s /usr/lib/jvm/jdk1.7.0_45/jre/bin/java /etc/alternatives/java

此时再启动eclipse,运行正常。