How to install jdk 8 on ubuntu server 18.04?

124
June 12, 2022, at 09:40 AM

I am trying to install JDK 8 ON Ubuntu server 18.04 LTS, with the following commands:

sudo apt install openjdk-8-jre
sudo apt install openjdk-8-jdk

/usr/lib/jvm folder has:

I also set the path into /etc/environment for JAVA_HOME But I still get an error while java -version as:

Command 'java' not found, but can be installed with:
sudo apt install default-jre            
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless 

Can anyone please suggest to solve an error? Thank you in advance.

Answer 1

Update alternatives for Java. This should fix the problem:

 update-alternatives --config java

Reference: https://linoxide.com/install-java-ubuntu/

Answer 2

try this one.

apt install oracle-java8-set-default

The above commands will automatically install selected java version and set all necessary java environment variables.

Answer 3

I got an answer, I mistakenly deleted default files i.e. java 11,

So I run following commands:

sudo apt purge -y openjdk-11-jre-headless
sudo apt purge -y openjdk-8-jre-headless
sudo apt purge -y default-jdk

then I run command to set java 8 as default:

sudo update-alternatives --config java

and the version is correctly reflect..

Rent Charter Buses Company
READ ALSO
Spring circular references prohibited in 2.6 version

Spring circular references prohibited in 2.6 version

I have an issue for circular reference callingEven if I set true to this option, I cannot fix my issue

153
org.apache.hadoop.security.AccessControlException: SIMPLE authentication is not enabled. Available:[TOKEN, KERBEROS]

org.apache.hadoop.security.AccessControlException: SIMPLE authentication is not enabled. Available:[TOKEN, KERBEROS]

I am trying to execute the hive table query in presto using Kerberos authentication, But it failed

186
Spring boot gradle build failing due to exception "HikariPool$PoolInitializationException" in unit test

Spring boot gradle build failing due to exception "HikariPool$PoolInitializationException" in unit test

Test cases are running fine when we run them individually it only gives this exception when we are trying to create a build

108