IT14064432 Firnas A.M IT14064432 Firnas A.M - 3 months ago 7x
Java Question

Java -version error

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.


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



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.