Reputation:
I have installed JDK 1.8 on my ubuntu 16.04, for some kind of work I had to install JDK 1.7.I installed it without did anything to my older version and changed the $JAVA_HOME to point the newly installed location.
echo $JAVA_HOME
works fine , showing newly installed version which is 1.7
but when I do $ java -version
it shows earlier installed version which is 1.8.
Why does this happen? How to resolve it.
I need 1.7 to work with it further.
If I went wrong in somewhere please correct me,I need good explanation regarding this.
Thank you. here is my terminal
Upvotes: 2
Views: 1113
Reputation: 1386
Try to run following command in terminal:
$ sudo update-alternatives --config java
It shows installed alternatives for java
command. You can choose which one you will use by default further on.
Upvotes: 5