Hello, I’m currently running into a strange problem with Java 1.7 under Mac OS.
I have set the JDK 1.7 path in my gradle.properties file like this:
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx1g -XX:MaxPermSize=128m
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
When I run a full build for my scala project, I get
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:compileScala’.
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 “/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre”
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
(Note aside: this happens because there are also java sources in the scala source path. If there are only scala source files, everything is fine)
So the question is: why is gradle using the JRE and not the JDK path (since gradle.properties points to the JDK)
I have no JAVA_HOME set. The java command on the path, is a java 1.6.
However, after setting
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
the problem is gone.
Nevertheless I would expect that providing
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
should be enough.
Cheers, Oliver