1

So initially when I tried $ls /usr/lib/jvm

no such directory

Then I tried $sudo apt-get install openjdk-8*

Now for $ls /usr/lib/jvm gives

java-1.7.0-openjdk-amd64  java-7-openjdk-amd64  openjdk-7
java-1.8.0-openjdk-amd64  java-8-openjdk-amd64  openjdk-8

Then for java -version

java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-2~deb8u1)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)

i.e by default it sets to java version 7.

And my problem is

  1. why this is installing both java versions

  2. And why it's openjdk-7 by default.

I want openjdk-8 by default. Any help on this.

Thank you.

1

You will want to use update-alternatives to set the default java installation for your system. This program will manage which program installation will fulfill generic programs for which there are many versions and/or alternatives.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/ jdk1.8.0/bin/java"

  • Thank you for you answer. But i want to know why It's installing both openjdks? – Jyothi Babu Araja Dec 23 '16 at 17:55
  • I wasn't sure about that one. Possibly some misconfigured dependency problem? – Kyle H Dec 23 '16 at 18:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.