2

I downloaded Oracle JDK-8 using sudo apt-get install oracle-java8-installer and set this version to default using sudo update-alternatives --config java but when I run java -version I get

java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
Zanna
  • 70,465

1 Answers1

7

Have you tried using update-java-alternatives instead of update-alternatives?

Show the list of available alternatives:

sudo update-java-alternatives -l

Select one of them:

sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • $sudo update-java-alternatives -l [sudo] password for harry: java-8-oracle 1081 /usr/lib/jvm/java-8-oracle

    $ java -version java version "10.0.1" 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

    – Haripal Baluja Jul 09 '18 at 11:54
  • I don't know how I have java 10.0.1 installed on my system – Haripal Baluja Jul 09 '18 at 11:58
  • have you run $sudo update-java-alternatives -s java-8-oracle – Leo Rodríguez Jul 10 '18 at 00:30
  • @HaripalBaluja: Could you please [edit] your post when you want to add information? Especially file or program output listings (with the help of the {} button in the editor toolbar) will be much more readable there; alternatively you can use a pastie service for longer listings and include the link of your pastie in your question. Overall it’s best to have everything relevant in one place. Additionally, comments may be deleted for various reasons. Thanks. – David Foerster Jul 10 '18 at 09:42
  • how to install a new java version? I only have version 11 installed – Alexander Mills Oct 14 '19 at 00:45