Ubuntu – Error while installing Android Studio, no JDK found

android-studiojdk

Tried other guides, no luck. Please assist

Got the following error

No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME
environment variable points to valid JDK installation.

Best Answer

To solve this error I had to do the following:

Install the Default JDK

sudo apt-get update
sudo apt-get install default-jdk

Set the JAVA_HOME Environment Variable

Get the JDK path here:

sudo update-alternatives --config java

Edit the environments file

sudo nano /etc/environment

And add the JAVA_HOME path to the end of the file:

JAVA_HOME="/usr/lib/jvm/java-8-oracle"

Then reload the environment with

source /etc/environment

After that I was able to start the Android Studio setup without the error.

Source: How To Install Java with Apt-Get on Ubuntu 16.04