1

I am on OS X Yosemite 10.10.3

I am running XCODE and receive the error

Error: JAVA_HOME is not defined correctly. We cannot execute /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java

I have looked at Where is JAVA_HOME on OSX Sierra (10.12), El Captain (10.11), Yosemite (10.10), Mavericks (10.9), Mountain Lion (10.8) or OSX Lion (10.7)? and tried all of the suggestions for the JAVA_HOME variable.

I have tried uninstalling and reinstalling java and the jdk from Oracle

java -version gives me

java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

I have made sure that in all the suggestions I replaced the version # with my correct version #.

Everyone that has made a response seems to have a CurrentJDK within /System/Library/Frameworks/JavaVM.framework/Versions/.

I only have A and Current

I am wondering if this is part of the reason I am getting the error, and how would I fix that?

Community
  • 1
  • 1
  • Well, what's in the `Current` directory? – Luke Jul 16 '15 at 18:03
  • @Luke `Commands JavaPluginCocoa.bundle _CodeSignature Frameworks JavaVM Headers Resources` – Samantha Simonds Jul 16 '15 at 18:20
  • Have you tried searching for java or javaw (the latter will probably give fewer results and narrow down the search) in JavaVM.framework? I'm not sure about the extension, I don't get around Macs well, but it'll report everything and you can see what you need. Then you just need to find the right file and see in which directory it is. Unless, of course, by then someone comes up with a more precise answer. – Luke Jul 16 '15 at 18:33
  • @Luke There is a java inside of `/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin` I have my current attempt of home as `export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)` which points to `/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home` – Samantha Simonds Jul 16 '15 at 18:42
  • That looks reasonable, could you try setting it as JAVA_HOME? Just guessing though, try with a few apps afterwards – Luke Jul 16 '15 at 18:43
  • @Luke Changing it to `/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin` or `/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java` Does not fix the error =/ – Samantha Simonds Jul 16 '15 at 18:52
  • Right, glad you find the solution anyway – Luke Jul 16 '15 at 20:07

1 Answers1

0

cd /System/Library/Frameworks/JavaVM.framework/Versions/

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents CurrentJDK

Running these 2 lines fixed my issue, and added a CurrentJDK to the Versions directory.