gradle-doctor icon indicating copy to clipboard operation
gradle-doctor copied to clipboard

Add shell fallback for JAVA_HOME detection

Open vladd-g opened this issue 1 year ago • 0 comments

The error "JAVA_HOME is not set" persisted even after setting the variable in shell config files:

| JAVA_HOME is not set.                                                                                |
| Please set JAVA_HOME so that switching between Android Studio and the terminal does not trigger a fu |
| ll rebuild.                                                                                          |
| To set JAVA_HOME: (using bash)                                                                       |
| echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile                                 |
| or `~/.zshrc` if using zsh.                                                                          |

Added a fallback mechanism to retrieve JAVA_HOME via shell command when System.getenv() fails to detect it.

vladd-g avatar Oct 30 '24 01:10 vladd-g