linux 查看java的安装路径
在linux下,如何找java的安装路径
han@ubuntu:
/etc
$
whereis
java
java:
/usr/bin/java
/usr/share/java
/usr/lib/jvm/java-8-openjdk-amd64/bin/java
/usr/share/man/man1/java
.1.gz
han@ubuntu:
/etc
$
ls
-lrt
/usr/bin/java
lrwxrwxrwx 1 root root 22 4月 2 15:54
/usr/bin/java
->
/etc/alternatives/java
han@ubuntu:
/etc
$
ls
-lrt
/etc/alternatives/java
lrwxrwxrwx 1 root root 46 4月 2 15:54
/etc/alternatives/java
->
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
然后编辑/etc/profilewen文件,在文件末尾添加
export
JAVA_HOME=
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
export
PATH=$JAVA_HOME
/bin
:$PATH
export
CLASSPATH=.:$JAVA_HOME
/lib/dt
.jar:$JAVA_HOME
/lib/tools
.jar
然后,运行
source
/etc/profile
查看JAVA_HOME环境变量
han@ubuntu:
/etc
$
echo
$JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64