Here is the output to some inspection that I did:
$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
and
$ update-java-alternatives -l
java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
and
$ ls /usr/lib/jvm/
default-java java-1.5.0-gcj-4.6 java-1.6.0-openjdk java-1.6.0-openjdk-amd64 java-6-openjdk java-6-openjdk-amd64 java-6-openjdk-common java-7-openjdk-amd64
With that in mind, how do I go about changing the default to 1.6 so that when I execute java -version, it tells me 1.6?
Thanks!
I am on Fedora but I hope that alternatives works the same way on Ubuntu. You need to run update-alternatives --config java
(on Fedora just alternatives --config java
) to see what options you have. Then type the number of the JDK you want to use and press enter. And that's it:-)
us below command to set the java. sudo update-alternatives --config java
It will display the option to select you appropriate java version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With