2

I want to upgrade my jdk on a CentOS server, after some simple searches I found some solutions.

From this link, you can see that the instructions are simple.

  • install your chosen jdk from rpm package or from source

  • possibly choose some alternatives

  • check that the new version installed (java -version)

The first two steps above, I easily completed, 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 symbolic links.

I have also tried which command to find out what java is actually running and this was the link directions.

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

the weird thing is that 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.

0

The problem was a system variable CLASSPATH.

and it must be exported in some way for example /etc/bashrc file because jdk needs to know the pass of classes and libraries to load it's modules.

in my case i sat CLASSPATH=/usr/java/jdk1.8.0_40/lib.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.