0

I have openjdk 1.8 installed via yum in '/usr/bin/java' and I have also downloaded the Oracle Java Hotspot 1.7 compiler in /opt/devel/jdk_1.7' I updated my PATH in my ~/.bashrc file to include/opt/dvel/jdk_1.7/bin'

When I run which java the terminal only responds with '/usr/bin/java'

  1. Why is the other java compiler in '/opt/devel/jdk_1.7/bin' not being found?
  2. How can I make this other compiler be the default compiler when executing java?
1
  • 1
    What does echo $PATH return? The very first path containing java dictates which version is executed. Note that the requirement to set JAVA_HOME in order to execute java is a fallacy. Commented Feb 24, 2015 at 1:57

1 Answer 1

1

I would set JAVA_HOME too in ~/.bashrc

Setting JAVA_HOME

jdk7oracle=/opt/devel/jdk_1.7 
export JAVA_HOME=$jdk7oracle export
PATH=$JAVA_HOME/bin:$PATH

and then test using

java -version

Also make sure you start a new terminal session so that bashrc is reloaded after your edits. OR you can source the bashrc file if you don't want to restart terminal.

source ~/.bashrc
Sign up to request clarification or add additional context in comments.

1 Comment

still not doing anything - meaning what? What is the output of "java -version" command?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.