how to change java_home on mac code example

Example 1: how to add java_home in mac

1. Open terminal window
2. Type command: $ vim ~/.bash_profile and Hit Enter
3. Type command: $ export JAVA_HOME=$(/usr/libexec/java_home) and press Escape key for Save changes.
4. Type command: :(colon)wq, It will Save and close .bash_profile file.
5. Type command: source ~/.bash_profile and hit Enter
6. Now we can check the value of the JAVA_HOME variable:
7. Type Command: echo $JAVA_HOME
 The result should be the path to the JDK installation:
 /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

Example 2: windows 10 change ANDROID_HOME

For Windows:
set ANDROID_HOME=C:\ installation location \android-sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Example 3: how to set path [email protected] on mac zsh

# This one worked perfect 
# you can always check first 
$ whcih openssl # before and after 
$ echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

Tags:

Java Example