We’ve several versions of the Java SDK installed. By setting the JAVA_HOME environment variable we want to select the desired Java SDK. We’re using the class
sun.security.ec.NamedCurve
(it isn’t a good practice to use sun internal classes). This class has been removed in Java SDK 8, so we can’t compile until Java SDK 8 is uninstalled. It would be nice if the rt.jar of the Java SDK would be taken, which is set by JAVA_HOME.
I think something more complex is going on here. By default, Gradle will compile with the Java being used to run Gradle and won’t look for any other unless explicitly told to.
Can you describe the setup a little more? Is there any special configuration of the compilation going on? How are you setting the ‘JAVA_HOME’ env var?
I’ve found the root cause of the problem: IntelliJ The rt.jar is placed in the bootclasspath inside IntelliJ. The IDE compiles but gradle fails. Gradle works as designed! Even when compiling the class with JDK7 on command-line the class NamedCurve could not be found, except rt.jar is placed in bootclasspath.