Skip to content
Advertisement

Execution failed for task ‘:app:compileJava’ with ./gradlew run

When I try using “./gradlew run” on my gradle projects, I receive this error:

JavaScript

I have tried on multiple different projects and it still doesn’t work. I believe it has something to do with gradle expecting a different version of Java, as I am using java 16 and when I check “gradle -v” it says “JVM: 15.0.2”. I am not sure how to fix this or if this is even the problem. Any help would be greatly appreciated!

Advertisement

Answer

Turns out I had multiple paths for java in my Path system variable. I deleted all but the correct one and then added a JAVA_HOME system variable with a value of the correct path for JDK (C:Program FilesJavajdk-“version”).

Advertisement