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
Should I Actually Remove the Valueeventlistener
How to Ping External Ip from Java Android
Rjava Load Error in Rstudio/R After "Upgrading" to Osx Yosemite
Sort a Map≪Key, Value≫ by Values
Converting Iso 8601-Compliant String to Java.Util.Date
How to Read Xml Using Xpath in Java
Explanation of Classcastexception in Java
How to Read All Files in a Folder from Java
Why Is It Considered a Bad Practice to Omit Curly Braces
Why Does My Function That Calls an API or Launches a Coroutine Return an Empty or Null Value
How to Set a Custom Font For Entire of Application
Firebase Android Listview Not Being Displayed
Change Date Format in a Java String
How to Resolve Classnotfoundexception
What's the Difference Between Next() and Nextline() Methods from Scanner Class