Popular blog tags

How To Install and uninstall reinstall OpenJDK on Ubuntu 18.04(aliyun)

Published

 

 

os: Ubuntu 18.04 

 

 

 

Install OpenJDK 8

sudo apt install openjdk-8-jdk

Verify the Java installation by running the following command which will print the Java version:

java -version

The output should look something like this:

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Java is installed

JVM home

/usr/share/elasticsearch/jdk

Uninstall  OpenJDK 8

step 1:take a look at installed OpenJDK packages

sudo dpkg --list | grep -i jdk

output

ii  openjdk-8-jdk:amd64                   8u292-b10-0ubuntu1~18.04                        amd64        OpenJDK Development Kit (JDK)
ii  openjdk-8-jdk-headless:amd64          8u292-b10-0ubuntu1~18.04                        amd64        OpenJDK Development Kit (JDK) (headless)
ii  openjdk-8-jre:amd64                   8u292-b10-0ubuntu1~18.04                        amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-8-jre-headless:amd64          8u292-b10-0ubuntu1~18.04                        amd64        OpenJDK Java runtime, using Hotspot JIT (headless

step 2:

sudo apt-get remove --purge icedtea-* openjdk-*