How to set java_home on Windows?
If you want to set JAVA_HOME environment variables globally and at system level means use should set in /etc/environment file.
First open /etc/environment file and place following code anywhere of the file.
1 2 3 |
... export JAVA_HOME=/usr/lib/jvm/java-[version] ... |
Here, [version] may changeable as per your Java Version. You can check like below commands,
1 2 |
$ echo $JAVA_HOME $ /usr/lib/jvm/java-[version] |
After set the JAVA_HOME variable, you should update and execute in every shell using following code,
1 |
$ source /etc/environment |
If you want to set JAVA_HOME environment variable in only the terminal, set it in ~/.bashrc file.
For Ubuntu, Open the ~/.bashrc file and put the below code at anywhere of the file,
1 2 3 |
... export JAVA_HOME=/usr/lib/jvm/java-[version] ... |
Here, [version] may changeable as per your Java Version.
Based on Jilles van Gurp, for Java optional package with other OSX things, use following method in same file ~/.bashrc,
1 2 3 |
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)" or export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)" |
Here, -v flag based on Jilles van Gurp response and 1.8 / 1.7 are the versions of jdk.
How to set java_home environment variable in windows? See Here.
Where and How to set JAVA_HOME on OSX, Yosemite, Lion, Mountain Lion, Mavericks, El capitan, Ubuntu
Latest posts by karsho (see all)
- Increase maximum query size max_allowed_packet for MySQL - March 29, 2020