Centos6.7上yum安装jdk1.8的JAVA_HOME

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos6.7上yum安装jdk1.8的JAVA_HOME相关的知识,希望对你有一定的参考价值。

今天问题还挺多,在VMware上安装Btrace时遇到的,Btrace需要读服务器的JAVA_HOME,当时我配置的是JAVA_HOME=/usr(我以为java命令所在的目录就是JAVA_HOME,真是二的可以),怎么起不来,报错如下:

Caused by: java.lang.ClassNotFoundException:com.sun.source.util.TaskListener

询问了开发以后,开发告诉我这是jdk里面的类,应该是你的JAVA_HOME不对。Google了一下,确实是这个问题。

 

到服务器查了一下,如下

$ rpm -qa |grep jdk

java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64

java-1.8.0-openjdk-headless-1.8.0.91-0.b14.el6_7.x86_64

java-1.8.0-openjdk-devel-1.8.0.91-0.b14.el6_7.x86_64

 

$ rpm -qljava-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre/bin/policytool

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre/lib/amd64/libawt_xawt.so

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre/lib/amd64/libjawt.so

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre/lib/amd64/libjsoundalsa.so

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre/lib/amd64/libsplashscreen.so

/usr/share/applications/java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64-policytool.desktop

/usr/share/icons/hicolor/16x16/apps/java-1.8.0.png

/usr/share/icons/hicolor/24x24/apps/java-1.8.0.png

/usr/share/icons/hicolor/32x32/apps/java-1.8.0.png

/usr/share/icons/hicolor/48x48/apps/java-1.8.0.png

 

$ cd /usr/lib/jvm

$ ll

总用量 4

lrwxrwxrwx. 1 root root   26 5  17 16:59 java-> /etc/alternatives/java_sdk

lrwxrwxrwx. 1 root root   32 5  17 16:59java-1.8.0 -> /etc/alternatives/java_sdk_1.8.0

drwxr-xr-x. 7 root root 4096 5  1716:59 java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64

lrwxrwxrwx. 1 root root   46 5  17 16:59java-1.8.0-openjdk.x86_64 -> java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64

lrwxrwxrwx. 1 root root   34 5  17 16:59java-openjdk -> /etc/alternatives/java_sdk_openjdk

lrwxrwxrwx. 1 root root   21 5  17 16:54 jre ->/etc/alternatives/jre

lrwxrwxrwx. 1 root root   27 5  17 16:54jre-1.8.0 -> /etc/alternatives/jre_1.8.0

lrwxrwxrwx. 1 root root   50 5  17 16:54jre-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64 ->java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre

lrwxrwxrwx. 1 root root   50 5  17 16:54jre-1.8.0-openjdk.x86_64 ->java-1.8.0-openjdk-1.8.0.91-0.b14.el6_7.x86_64/jre

lrwxrwxrwx. 1 root root   29 5  17 16:54jre-openjdk -> /etc/alternatives/jre_openjdk

 

o(_)o ,找到了,JAVA_HOME/usr/lib/jvm/java


本文出自 “Hades博客” 博客,请务必保留此出处http://hades02.blog.51cto.com/9768670/1782261

以上是关于Centos6.7上yum安装jdk1.8的JAVA_HOME的主要内容,如果未能解决你的问题,请参考以下文章

centos6.7安装tomcat

安装与配置Elasticsearch

如何在CentOS 7上安装jdk1.8服务器

centos通过yum安装jdk1.8

使用yum安装jdk1.8

centos6 7 yum安装mongodb 3.6