I have tried and looked at the past Gradle Java_HOME questions, however none of the options seems to work. I followed this website to install Gradle. However, all the Gradle commands I run result in the following error:
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/jdk1.8.0_241
Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
I'm also using OpenJDK 11 and
$ echo $JAVA_HOME
/usr/lib/jvm/jdk1.8.0_241
You can find java home by using the following command:
It will print something like:
You can set the output of this command as JAVA_HOME by copying the path and adding the following line to your
~/.bashrc
.