1. Problems
appledeMacBook-Pro:~ apple$ gradle -version ERROR: JAVA_HOME is set to an invalid directory: /usr/local/opt/openjdk Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
2. Solution
vim /usr/local/bin/gradle
#!/bin/bash #JAVA_HOME="${JAVA_HOME:-/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home}" exec "/usr/local/Cellar/gradle/7.0/libexec/bin/gradle" "$@" JAVA_HOME="${JAVA_HOME:-/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home}" exec "/usr/local/Cellar/gradle/7.0/libexec/bin/gradle" "$@"
Similar Posts:
- [Solved] JMeter startup error: integer expression expected
- JAVA_HOME is not defined correctly [How to Solve]
- [Solved] Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8
- Mac Mvn Package Error: No compiler is provided in this environment. Perhaps you are running on a JRE rather …
- objc[20556]:Class JavaLaunchHelper is implemented in both xxx [How to Solve]
- SDK location not found. Define location with sdk.dir in the local.properties file or with an AND…
- JAVA Command Error: A JNI error has occurred, please check your installation and try again [Solved]
- [Solved] NB: JAVA_HOME should point to a JDK not a JRE
- [Solved] Err:12 http://security.ubuntu.com/ubuntu focal-updates/main amd64 openjdk-11-jre-headless amd64 11.0.11+9-0ubuntu2~20.04 404 Not Found [IP: 91.189.88.152 80]
- [Solved] Mac install maven Error: zsh: command not found: MVN