Hello, everyone :wave:. I’ve just created a new KM...
# multiplatform
Hello, everyone 👋. I’ve just created a new KMM project, but when tried to open it on XCode it shows the following error:
Copy code
The operation could''t be completed. Unable to locate a Java Runtime.
Please visit <http://www.java.com> for information on installing Java.

Command PhaseScriptExecution failed with a nonzero exit code
From Android Studio I even can run it on an iOS emulator, but I can’t get preview or run it from xcode. Anyone to help me on that 😄 ?
oh, just some details: • I use
to manage my sdks (including JDK) and I installed through it • if I type:
javac -version
it shows the correct version that I’ve installed, but if I type:
/usr/libexec/java_home -V
it shows
Copy code
The operation couldn't be completed. Unable to locate a Java Runtime.
Which is the same message that appears on xcode logs. Do you think it has something to do with JDK/JRE path?
in a terminal, does
return anything? I don't use XCode, but my guess is that it
isn't set, or XCode has some other way of setting it
I don't have anything in JAVA_HOME but my java executable is in /usr/bin. Can you type which java and see if the path is what you expect? Are you certain you have a JDK installed and not a JRE?
returns: /Users/henriquehorbovyi/.sdkman/candidates/java/current
which java
also returns /Users/henriquehorbovyi/.sdkman/candidates/java/current/bin/java
You may need to set java home then to point to it, and as I haven't used sdkman you can look at the comments here. https://github.com/sdkman/sdkman-cli/issues/431
Well, I found out a solution The problem: • xcode was expecting that this program /usr/libexec/java_home (which is the default for the OS) would return the path of my installed java • But I have installed java via sdkman and
can only identify a java path if it would come from a macOS normal installation (if I had downloaded a jdk.dmg for example) How I solved: • I solved the problem by adding a custom path called JAVA_HOME inside xcode locations preferences
👍 1