I''ve installed gradle via SDK, and my java version is 11.0.14. But whe I run gradle -v it returns:
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_321 (Oracle Corporation 25.321-b07)
OS: Linux 5.4.0-109-generic amd64
Java --version:
java 11.0.14 2022-01-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.14+8-LTS-263)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.14+8-LTS-263, mixed mode)
But I want this gradle JVM to be 11.0.14, how can I change this?
Related
C:\Users\91842>hadoop -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) Client VM (build 25.91-b15, mixed mode)
I tried this but got no result -
$ java -XX:+PrintFlagsFinal -version | grep UnlockExperimentalVMOptions
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
Is the flag UnlockExperimentalVMOptions removed or
Am I doing something wrong or what??
UnlockExperimentalVMOptions is itself an experimental VM option :)
To see it in the list of flags, use -XX:+UnlockExperimentalVMOptions
java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version | grep UnlockExperimentalVMOptions
bool UnlockExperimentalVMOptions := true {experimental}
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
BTW, there is a great project by Chris Newland - VM Options Explorer
/home/user/gradle-5.6.4/bin/gradle -Dorg.gradle.java.home=/home/user/java11/jdk-11.0.2 -version
Output
Gradle 5.6.4
------------------------------------------------------------
Build time: 2019-11-01 20:42:00 UTC
Revision: dd870424f9bd8e195d614dc14bb140f43c22da98
Kotlin: 1.3.41
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 1.8.0_252 (Private Build 25.252-b09)
OS: Linux 4.15.0-106-generic amd64
Why is it picking 1.8.0_252?
It looks like your post is mostly code; please add some more details.
feedback for so
Turns out the -Dorg.gradle.java.home does not override JAVA_HOME
echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/
I am trying to run a simple spring boot project with java 11 but I can not add it as jre. I am getting following error while adding it as jre
I am using following java version on maco os 10.13.16
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
I tried to use the similar path( Contents/Home/lib) for jdk10 and it recognised as jre 10. I think that STS is not able to read jrt-fs.jar for java 11.
Can somebody pleas give some advice?
The JRE home for Java 11.0.2 on macOS is
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
(no 'lib' at the end)
When using Gradle 2.x, 3.x, and 4.x that only supports Java 8, the gradle runtime does NOT run. I just installed JDK 9 on my MAC and now Gradle 2.x does NOT run. Any versions before 4.2.1.
$ gradle
$
Nothing happens... How to fix that?
According to https://blog.gradle.org/java-9-support-update, Java 9 support for Gradle came to Gradle 4.2.1.
After installing Java 9, you will have it by default in your system:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
9.0.1, x86_64: "Java SE 9.0.1" /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
At this point, you need to find the Gradle executable and change the JAVA_HOME to point to your Java 8 version because you still have it installed. Change the binary to define the JAVA_HOME to point to the Version 8 version.
~ ⌚ 22:54:20
$ which gradle
/usr/local/bin/gradle
~ ⌚ 11:19:12
$ vim /usr/local/bin/gradle
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
After this, Gradle will work again!
$ gradle --version
------------------------------------------------------------
Gradle 2.13
------------------------------------------------------------
Build time: 2016-04-25 04:10:10 UTC
Build number: none
Revision: 3b427b1481e46232107303c90be7b05079b05b1c
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_131 (Oracle Corporation 25.131-b11)
OS: Mac OS X 10.12.6 x86_64