-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usability Improvement: Support /usr/libexec/java_home
to find path for JDK on macOS
#74
Comments
We are actually using a utility to resolve JAVA_HOME which in turn seems to be using the mac utility that you have mentioned. Does your JAVA_HOME (the value returned from mac utility) point to a JRE or JDK? |
> env | grep JAVA
> which javac
/usr/bin/javac
> readlink /usr/bin/javac
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
> ls /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/ | grep home
java_home
> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
> /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home When I remove Edit: Maybe as an additional help for finding out where exactly things break. The |
I guess the bug is here: vscode-java/src/requirements.ts Line 71 in 810cc60
This always sets the |
/usr/libexec/java_home
to find path for JDK on macOS /usr/libexec/java_home
to find path for JDK on macOS
On macOS there is a standard way to find the location of the JDK, invoking
/usr/libexec/java_home
:http://stackoverflow.com/questions/18144660/what-is-path-of-jdk-on-mac
https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/java_home.1.html
I was a bit confused that vscode-java didn't work out of the box (also no apparent error message, just a message about installing something in the corner that didn't change. I had to set
java.home
in the settings to the value returned by/usr/libexec/java_home
and then it worked. I guess this should be true on most macOS systems and vscode-java could use it directly to find the java home path, making installation easier.The text was updated successfully, but these errors were encountered: