$ gradle buildGhidra
I get the following error:> Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'
This seems weird because I do have java 11:
$ java --version
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)
What am I missing?
I got this problem when trying to build using gradle through Intellij.
In my case I had two JDK's JDK1.8 and JDK 11 installed and configured in Intellij. For Gradle it was taking JDK1.8 as default JVM. I solved the issue using below steps :
Gradle uses the java distribution defined in your JAVA_HOME
environment variable - it does not look at the java executable in your path. So make sure this variable points to a valid JDK 11 path. You can verify if it is set up correctly by running gradle --version
, e.g.
$ echo %JAVA_HOME%
C:\Work\JDKs\jdk-11.0.8+10
$ gradle --version
------------------------------------------------------------
Gradle 6.6
------------------------------------------------------------
Build time: 2020-08-10 22:06:19 UTC
Revision: d119144684a0c301aea027b79857815659e431b9
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 11.0.8 (AdoptOpenJDK 11.0.8+10)
OS: Windows 10 10.0 amd64
(Notice the JVM part above.)
Are you using an IDE? Make sure that in your Gradle settings, Gradle is using the same java version as your project, this can be easily configured in Intellij https://www.jetbrains.com/help/idea/gradle-jvm-selection.html#jdk_existing_project
gradle
was after all the one to blame.gradle-6.7 --version
, without any JAVA_HOME change whatsoever, I got:
------------------------------------------------------------
Gradle 6.7-rc-3
------------------------------------------------------------
Build time: 2020-09-30 19:16:51 UTC
Revision: 836e96a80625c9c48b612e662e3b13bd2e2f4c3b
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 11.0.8 (Ubuntu 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
OS: Linux 5.4.0-48-generic amd64
Which probably "proves" gradle is indeed the one to blame
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With