1

I installed a new jdk 1.6 parallel to that existing 1.5, however I got this error when I run the java binary.

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

I already set my PATH variable to include the new jdk bin directory.

0

Try setting your JAVA_HOME variable to the base directory instead.

export JAVA_HOME=/path/to/jdk1.5r8
/path/to/jdk1.5r8/bin/java -version

Java respects JAVA_HOME and JAVA_OPTS for almost everything.

0

This what I setup in the bash profile in our servers.

export JAVA_HOME_8=$HOME/3rd/jdk1.8.0
export JAVA_HOME_6=$HOME/3rd/jdk1.6.0_38

alias j6='export JAVA_HOME=$JAVA_HOME_6;export PATH=$JAVA_HOME/bin:$PATH'
alias j8='export JAVA_HOME=$JAVA_HOME_8;export PATH=$JAVA_HOME/bin:$PATH'

When we need java6 we type j6 in the command prompt to load the java6 environment or j8 to load the java8 environment

0

make sure the jdk version you want to use in PATH and JAVA_HOME are same. you can keep switching between the versions by updating the two fields.

Your Answer

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