FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ":core:compileJava'
> Could not find tools.jar
If you get the above error when you try to build and run your Java Gradle-based project, the reason is tools.jar is not accessible.
Fix:
Open the build.gradle file of your project and make sure you have provided the property sourceCompatibility correctly.
Example for Android Studio Project:
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
Note: Make sure Java JDK is installed on your device, if not get it installed.
Also make sure that JAVA_HOME is set in zshrc or bash profile file.
export JAVA_HOME=/path/to/java-jdk
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!