After upgrading my macOS to Big Sur, I have not been able to run my grails application. I keep getting this error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':server:compileGroovy'.
Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
I have reinstalled java, but still getting the same error.
Use this command to see java paths: /usr/libexec/java_home -V | grep jdk
Copying tools.jar in /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/ to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/ solved the problem.
Related
My react native android was compiling fine until I added react-native-firebase as per the docs (ios compiles fine).
React Native 0.63.2 and react-native-firebase 8.3.0 latest versions
and followed docs very carefully. OSX 10.15.6
Deleted/cleared/reinstalled gradle and android gradle/build dirs etc.
java JRE v8.202 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
java JRE v8.202 /Library/Java/JavaVirtualMachines
Note that JAVA_HOME path set to /Applications/AndroidStudio.app/Contents/jre/jd/Contents/Home
Error:
> Task :react-native-firebase_app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-firebase_app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
I'm using Mac Bigsur beta 4, and I have the same problem.
I tried uninstalling java by following the steps in this link:
https://www.java.com/en/download/help/mac_uninstall_java.xml
After that I checked the java version in terminal using: java -version.
The uninstall process didn't work. However, running react-native run-android now works.
Try this. It may work for you.
Note: If you tried uninstalling java, and running react-native run-android still doesn't work, add this to bash_profile and try again: export JAVA_HOME=/Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home
Ran source ~/.bash_profile to ensure JAVA_HOME path set to /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home and it compiled, yay.
This question already has answers here:
Gradle does not find tools.jar
(30 answers)
Closed 4 years ago.
I found this post but the answer did not solve my problem. The answers only address windows systems and provide file paths which are not helpful for the OS I am running.
I am running openSUSE Leap 15 with Java 1.8, changing the OS or Java version is not an option.
When I try to build with the command ./gradlew clean build i get the following error:
:buildtools:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildtools:compileJava'.
> Could not find tools.jar. Please check that /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre contains a valid JDK installation.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.364 secs
I have checked my Java installation like this:
$> rpm -qa | grep java
javapackages-tools-5.0.0+git20180104.9367c8f6-lp150.1.2.x86_64
timezone-java-2018g-lp150.2.13.1.noarch
java-1_8_0-openjdk-1.8.0.181-lp150.2.6.1.x86_64
libjavascriptcoregtk-4_0-18-2.20.5-lp150.2.6.1.x86_64
java-1_8_0-openjdk-headless-1.8.0.181-lp150.2.6.1.x86_64
I also checked out JAVA_HOME:
$> echo $JAVA_HOME
/usr/lib64/jvm/jre-1.8.0-openjdk
The comments inspired me to find a solution. Apparently installing the package java-1_8_0-openjdk will only provide the OpenJDK 8 runtime environment. I wrongly expected it to include the development tools because of the 'jdk' in its name (Java Development Kit).
My problem was solved by simply installing the package java-1_8_0-openjdk-devel which actually includes the development tools, like this: sudo zypper in java-1_8_0-openjdk-devel.
The command zypper se jdk can help you to figure out the status of your jdk installation. After installing the package java-1_8_0-openjdk-devel you should see an i+ next to the package name. You should be able to spot the following two lines:
i+ | java-1_8_0-openjdk | OpenJDK 8 Runtime Environment | package
i+ | java-1_8_0-openjdk-devel | OpenJDK 8 Development Environment | package
I update java to the lasted version e then I following this guide to install grade using Homebrew:
gradle installation guide
When the gradle installation is finished, I tried to launch gradre using the command: grade by command line but appear this error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9.0.1'.
How can I fix this problem?
It is a Gradle bug has been fixed in version 4.2.1:
https://github.com/gradle/gradle/commit/d9c35cf9d74c102641fcfe0bb7bf622791a96caf
I am building aprofplot on Ubuntu using Apache Ant. When I enter the command ant in the folder containing build.xml, I get this error:
BUILD FAILED
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:923: The following error occurred while executing this line:
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:263: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"
Total time: 2 seconds
ashwin#ashwin-VirtualBox:~/aprof/aprofplot$ javac --version
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.8-jdk
* openjdk-7-jdk
* gcj-4.6-jdk
* openjdk-6-jdk
I have openjdk installed too. What am I doing wrong? Do I have to install further packages?
It seems, you have wrong JAVA_HOME variable. It points to JRE, from your output:
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"
Not JDK. That is why, Ant can't locate the javac and fails. You have to modify it. Try to delete jre at the end, seems, javac should be under /usr/lib/jvm/java-7-openjdk-amd64/bin. So you have to set it to/usr/lib/jvm/java-7-openjdk-amd64
I was trying to install Xuggle on Ubuntu with this tutorial
But when I used ant stage it doesn`t work. I see these commands on the terminal
> root#test1:~# ant stage Unable to locate tools.jar. Expected to find
> it in /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar Buildfile:
> build.xml does not exist! Build failed
Do you have any idea how I can fix it?
The tools.jar error will be because ant can't find your JDK, it appears to be looking in the open JDK location. You might need to install oracle-java7-set-default so it points your system java to the oracle java you just installed.