简体   繁体   English

在centos 6.5中升级后,java返回VM错误

[英]java returns VM error after upgrade in centos 6.5

I want to upgrade my jdk on a centos server, after some simple searches i found some solutions. 我想在centos服务器上升级我的jdk,经过一些简单的搜索,我找到了一些解决方案。

from this link you can see that the instructions are simple: jdk 7 installation guide for centos 从此链接可以看到,说明很简单: jdk 7 centos安装指南

-install your jdk from rpm package or from source -从rpm包或源代码安装jdk

-do some alternatives -做一些选择

-check the practical version (java -version) -检查实际版本(java -version)

and i go easy with the first two steps but in check version step i get this error: 我可以轻松地执行前两个步骤,但在检查版本步骤中却遇到此错误:

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

i have also checked alternatives --config java and simbolic links. 我还检查了alternatives --config java和simbolic链接。

i have also tried which command to find out what java is actually running and this was the link directoins. 我还尝试了which命令来找出实际正在运行的Java,这就是链接Directoins。

/usr/bin/java -> /etc/alternatives/java -> /usr/java/jdk-1.8.0_40/bin/java

the weird point is when i run /usr/bin/java -version it is OK and it returns the version but when i run java without any prefix i got that error. 奇怪的是,当我运行/usr/bin/java -version它确定并返回版本,但是当我运行不带任何前缀的java时,出现该错误。

so what is the problem? 那是什么问题呢?

you may need to setup CLASSPATH variable so that jvm could load needed libraries. 您可能需要设置CLASSPATH变量,以便jvm可以加载所需的库。

see this post https://docs.oracle.com/javase/tutorial/essential/environment/paths.html 看到这篇文章https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM