标签:配置环境 roo whereis no-repeat nbsp local round java code
查看yum中管理的可用的JDK软件包列表:
yum search java | grep -i --color JDK
2.选择jdk版本,,进行安装
yum install java-1.8.0-openjdk-devel.x86_64
3.配置环境变量,vim /etc/profile ,在最后位置添加
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.i386/bin/java export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
4.保存关闭后,执行 source /etc/profile让配置生效:
source /etc/profile
5.输入 Java -version查看是否安装成功
附: linux下,如何找java的安装路径?
[root@localhost logs]# whereis java
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz
[root@localhost logs]# ls -lrt /usr/bin/java
lrwxrwxrwx. 1 root root 22 Sep 17 08:12 /usr/bin/java -> /etc/alternatives/java
[root@localhost logs]# ls -lrt /etc/alternatives/java
lrwxrwxrwx. 1 root root 44 Sep 17 08:12 /etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk.i386/bin/java
查看JAVA_HOME环境变量
[root@localhost jvm]# echo $JAVA_HOME
/usr/lib/jvm/jre-1.8.0-openjdk.i386/bin/java
标签:配置环境 roo whereis no-repeat nbsp local round java code
原文地址:https://www.cnblogs.com/fuyublog/p/11546372.html