Many java based application requires to set JAVA_HOME env variable. What's the purpose of this variable?
To set JAVA_HOME, do the following: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.
I'd recommend setting it as a system variable. JAVA_HOME is used by Gradle and Maven build tools (and some other things) to know where the root directory of your JDK is located. It should point to the folder where the bin folder is located, ie C:\Program Files\Java\jdk-11.0.
Download Liberica JDK and on installation it will automatically set JAVA_HOME environment variable. Now you just go to Android Studio -> Project Structure -> SDK -> Point all jdk path to liberica jdk installation directory and apply. You are done. Just restart android studio and gradle command will work.
Environment variables are strings that contain information such as drive, path, or file name.
The JAVA_HOME environment variable points to the directory where the Java runtime environment (JRE) is installed on your computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With