which javac
返回/usr/bin/javac
file /usr/bin/javac
返回/usr/bin/javac: symbolic link to `/etc/alternatives/javac'
然后file /etc/alternatives/javac
返回/etc/alternatives/javac: symbolic link to `/usr/lib/jvm/java-6-sun/bin/javac'
然后file /usr/lib/jvm/java-6-sun/bin/javac
返回/usr/lib/jvm/java-6-sun/bin/javac: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped
到此为止,说明路径是/usr/lib/jvm/java-6-sun/bin/,在Eclipse里面设置即可。
一、jdk安装,源码安装
tar -zxvf jdk-8u131-linux-x64.tar.gz -C /home/Java/
二、JDK环境配置
使用命令 sudo vim /etc/profile 打开 /etc/profile 文件,然后在文件末尾添加如下内容:
export JAVA_HOME=/home/Java/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
终端输入一下命令使配置生效:source /etc/profile
重启系统即可。
java -version,如果查看到 java 版本信息,即表示成功安装了。