-1

I tried installing java on Amazon linux.

I installed jdk 1.8.0 and I changed PATH to .bash_profile

export JAVA_HOME=/home/.../jdk1.8.0_192
export PATH=$JAVA_HOME/bin:$PATH

but java -version still returns old java version (1.7.0)

I checked the result was JAVA_HOME = /usr/lib/jvm/jre

if I check which java then the result is /usr/bin/java

how to change the java version to the new one?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Open new console and try again. – talex Jan 14 '19 at 07:50
  • 2
    Possible duplicate of [JAVA\_HOME and PATH are set but java -version still shows the old one](https://stackoverflow.com/q/14119983/608639). Or, which duplicate do you prefer: [linux how to set "java_home" path site:stackoverflow.com](https://www.google.com/search?q=linux+how+to+set+%22java_home%22+path+site%3Astackoverflow.com)? – jww Jan 14 '19 at 08:02

1 Answers1

0

you need to type below command on shell

sudo update-alternatives --config java

It will display all available JRE and you need to type the number which java you want to select(You can perform this for javac also).

vivekdubey
  • 484
  • 2
  • 7