Xcode and sdkman

If you use sdkman like I do, you might need to tell Xcode where to find it if you run into " Unable to locate a Java Runtime" during a failed build of the iosApp in Xcode. You can do this by creating environment.plist in ~/Library/LaunchAgents/ and pasting in this code

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>
    launchctl setenv JAVA_HOME /Users/user/.sdkman/candidates/java/current/
    </string>

  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

Be sure to use your actual username in place of “user” above

courtesy of this post:

1 Like

Thank you for the heads up evanadwyer!

We’re going to look into this and add it on the next book revision :].