Hi everyone! I'm running into this error when I ru...
# troubleshoot
a
Hi everyone! I'm running into this error when I run `gradle build`:
* What went wrong:
Execution failed for task ':li-utils:compileMainGeneratedDataTemplateJava'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64/jre contains a valid JDK installation.
Running
java -version
outputs this:
openjdk version "11.0.17" 2022-10-18 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS, mixed mode, sharing)
My JAVA_HOME variable is set to the Java 11 location. It seems that when I try to run build, gradle is picking up a different, older version of Java that I had been using previously.
b
There is actually a requirement for both java 8 jdk and java 11 jdk installed. This is tied to some specific requirements buried in the project due to Spark 2.4 integration. I am curious as to whether the detected java 8 installation mentioned in the error message is still installed and whether it would provide a working jdk? Another issue I have seen is that some folks started using jenv and then later removed it, but left some environment variable configurations around which caused issues. jenv is not required to build the project.
a
I do still have Java 8 installed, which was the version I was using before the requirement for Java 11 to be installed as well. It would build before, and I haven't modified the Java 8 folder, so the jre folder should be untouched as well. I'm curious as to why it would build previously, but not anymore now that I have both installed.
b
In your initial post you indicated running
gradle build
however is that just in the message and you are actually running
./gradlew build
. I ask because it might be the case where you are running an older version of gradle and not the wrapper which is version of 6.9.2
a
I am running
gradle build
and not
./gradlew build
, as the former command will allow me to bypass firewall and go through proxy. But my gradle version is 6.9.2.
b
Can you check the location
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64/jre
for the expected
tools.jar
? Is it missing like the error indicates or is it in fact present but not being properly detected? If not you likely need the
-devel
package for what is maybe Centos?
m
@brainy-tent-14503 any resolution for this ? because I'm facing the same issue
b
The resolution is to install both the jdk8 and jdk11 packages and if your distribution has a -devel or -dev package to make sure those are included. Note that this is only required to build from source.