Mac: Gradle issues with finding/using JDK 7 - the usual answers dont work. expert?

Discussion in 'OS X Mountain Lion (10.8)' started by stefoid, Jul 2, 2014.

  1. stefoid macrumors newbie

    Joined:
    Jul 2, 2014
    #1
    This issue appears to be related directly to a bizarre gradle/osx interaction, rather than the IDEs using Gradle.

    In Android Studio and Eclipse I am having issues with the gradle-build bombing out with errors that the web tells me are related to the JDK. The gradle-based build works with the Apple provided JDK1.6, but when I install Oracle JDK1.7, which is required for the projects I am doing, it bombs

    Error:Execution failed for task ':app:compileDebugJava'.
    Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.


    On my other mac, I dont have any problems. The setup is the same as far as I can tell. Its just that for some reason, on one machine, Android Studio / Gradle pops this error message.

    In Android Studio I have set file->other settings->default project settings-> JDK location to the JDK location listed below in JAVA_HOME.

    I have set

    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.060.jdk/Contents/Home

    running /usr/libexec/javahome gives: /Library/Java/JavaVirtualMachines/jdk1.7.060.jdk/Contents/Home

    running javac -version gives :
    javac 1.7.0_60-ea

    running java -version gives:
    java version "1.7.060-ea"
    Java(TM) SE Runtime Environment (build 1.7.060-ea-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

    I have even manually set the symlink CurrentJDK to the 1.7JDK as I have seen that offered as a solution a few times - no luck.

    SIMILARLY, in ECLIPSE when running a different (libgdx) gradle-based project, the build process fails with this error:

    com/github/jtakakura/gradle/plugins/robovm/RoboVMPlugin : Unsupported major.minor version 51.0

    Which posts from libgdx folk say is also related to the JDK1.7 being required.

    WHY DOES MY ENTIRE SYSTEM EXCEPT AGREE THAT JDK1.7 IS BEING USED, EXCEPT FOR GRADLE?!?!?!

    I have verified on numerous machines that I can get Gradle to build with the same install procedures and setup, but on my main machine I use for work at home, something is wrong deep inside OSX.

    I have asked the Gradle folk here, but they gave up. According to them, everything should be fine, except that it isnt.

    http://forums.gradle.org/gradle/topics/mac_gradle_issues_with_finding_using_jdk_7_the_usual_answers_to_this_question_arent_working_expert_required

    So MAC experts, what can I do? I have reinstalled Mavericks over the top, but it didnt help. Whatever it is, was not cleaned by that process. I have clean installed mavericks and then reinstalled my own stuff from timemachine, but that didnt help either. I am trying to avoid having to go to a clean install and then manually reinstall everything, which would be wrist slitting time.
     
  2. stefoid thread starter macrumors newbie

    Joined:
    Jul 2, 2014

Share This Page