7
  • Complementary to this question: tell-gradle-to-use-specific-java-version
  • How can I determine (verify) the java version actually used in gradle build?
  • After a successful ./gradlew build, I looked for javac, but it was just in a binary file:
$ grep -rn "javac"
Binary file .gradle/4.6/taskHistory/taskHistory.bin matches
  • I have many java versions installed, so a mixup is possible.
  • Is there any way to verify the java version?
OrenIshShalom
  • 5,974
  • 9
  • 37
  • 87

2 Answers2

7

./gradlew --version will tell you which jdk version you are using.

Kaj Hejer
  • 955
  • 4
  • 18
  • 7
    This gives the JRE version that gradle is running under. It could be different from the javac version it will use to compile java files. – k314159 Mar 29 '21 at 12:53
2

If you add --info to the build command it will tell you what java exe it is using for the compile:

./gradlew build --info

Then look for the string Starting process and you will see a line like:

Starting process 'Gradle Worker Daemon 10'. Working directory: C:\dev\.gradle\workers Command: C:\dev\.jdks\corretto-11.0.13\bin\java.exe ...'
Joman68
  • 2,248
  • 3
  • 34
  • 36