Gradle Finds Wrong Java_Home Even Though It's Correctly Set

Gradle finds wrong JAVA_HOME even though it's correctly set

Turns out that the particular Gradle binary I downloaded from the Ubuntu 13.10 repository itself tries to export JAVA_HOME. Thanks to Lucas for suggesting this.

/usr/bin/gradle line 70:

export JAVA_HOME=/usr/lib/jvm/default-java

Commenting this line out solves the problem, and Gradle finds the correct path to the Java binary.

If you just download the binary from their website it does not have this problem,
It's an issue with the Ubuntu repo version. There also seem to be some other issues with 13.10 version.

Windows 10 Gradle: JAVA_HOME is set to an invalid directory

Looks like your JAVA_HOME variable resolves to a JRE installation directory. But as you're talking about Gradle, you're surely trying to build/compile code.

If you have a JDK installed, change JAVA_HOME variable to point to it. The folder name should typically start with "jdk". Otherwise, you have to install a Java Development Kit.

You could also try exporting the variable manually before running gradle on the command line (SET JAVA_HOME=<path to the jdk directory>)

Gradle JAVA_HOME anomaly

This appears to be a known issue with Gradle: https://github.com/gradle/gradle/issues/18092

Gradle does not recognize the JAVA_HOME I have set

it is quite common issue. Just go to your gradle home directory and bin, for example:

/home/user/gradle-2.0/bin

and there you should have gradle script, I am on a Windows machine now so I have gradle.bat, probably you will have gradle.sh or something like this. In that file, find the line:

set JAVA_HOME=%JAVA_HOME:"=%

or as I can see you are on linux so there will be "export" and change it to your java home directory for example:

export JAVA_HOME=/usr/lib/jvm/java-7-oracle

Although I have JAVA_Home set, the system can not find it

Tomcat calls a script, setenv.sh, from catalina.sh.

Create a script called setenv.sh in the directory CATALINA_BASE/bin, and add the line: "export JAVA_HOME=/usr/lib/jvm/jdk11". Make the script executable, i.e. chmod +x setenv.sh



Related Topics



Leave a reply



Submit