Monday, December 14, 2020

Set environment variable for JAVA_HOME

1. .profile for mac user

with the new update for mac os, the default terminal has moved from bash to zsh, so if you previously use .profile to setup the environment and path for current user, then you will need to change the file name to .zprofile, as zsh will load .zprofile, instead of .profile when a new terminal starts.


2.Display environment variable in console or terminal window

on Windows

echo %JAVA_HOME%


on mac, 

echo $JAVA_HOME


3. set environment variable for a particular terminal or console 

on windows:

set JAVA_HOME=C:\Program Files\Java\jdk1.8.0

Do not include quotation marks. This will not affect the JAVA_HOME environment variable setting in control panel's environment settings. 

No comments:

Post a Comment