linux 查看java的安装路径

在linux下,如何找java的安装路径

han@ubuntu:/etcwhereis 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:/etcls -lrt /usr/bin/java
lrwxrwxrwx 1 root root 22 4月   2 15:54 /usr/bin/java -> /etc/alternatives/java
han@ubuntu:/etcls -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:/etcecho $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
posted @ 2019-11-29 20:21  跃小云  阅读(4062)  评论(0编辑  收藏  举报