Judging from the error you are seeing seems like Gradle is set to point at your JRE standalone installation and not the JDK...
Judging also from your post, seems like you are running Windows.
So, first of, make sure you have the JDK installed:
- You can search for it in your file system yourself (which is most likely located under
C:\Program Files\Java\
directory).
- Open a CLI (ie Command Line Interface, or command prompt) and type
javac -version
and tell us how it responds.
- Open a CLI and type
where javac
and tell us how it responds. It should print the location of your javac.exe
executable (which will be under the JDK install directory, which in turn will let us know where is your JDK installed).
If you don't have the JDK installed, make sure you do, by downloading+installing it. For example you can get Oracle's JDKs from here. Make sure you select the desired JDK and not JRE. For example for version 8 (which is the version of Java I can see you are using) you can navigate here.
Then, make sure Gradle points to the JDK installation and not the standalone JRE.
To do this, I am not an expert on it, but if Gradle is using JAVA_HOME
enviroment variable, make sure this value points to your JDK and not the JRE. You can open a CLI and type
echo %JAVA_HOME%
and tell us how it responds. If it shows a JRE installation, try changing this enviroment variable to the JDK installation. Also don't forget to put %JAVA_HOME%\bin
in your PATH
enviroment variable if it is not already (more on this later in this post).
By the way, which IDE are you using (for example Android Studio, Eclipse, etc...)?
Aside from everything I am suggesting you here to tell us, you can try the following answers in another similar post which may help:
- How to configure Gradle to run from JDK.
- How to set
JAVA_HOME
properly to point to the JDK.
- How to override default
java.home
Gradle property.
Note that JAVA_HOME
is an enviroment variable which should point to the JDK, while the java.home
is a Gradle property which should point to the JRE.
Try the possible solutions above, and don't forget to let us know your observations and how each CLI command responds.