Configuring System Environment Variables
Configuring System Environment Variables
Use this procedure to set the Java, Maven, and MySQL system environment variables.
- Open the Start menu, right-click Computer and select Properties.
- Click Advanced System Settings.
- In the Environment Variables.
- To add a new system environment variable, on the Environment Variables window, click New.
- Add the following:
Variable Name Variable Value JAVA_HOME
C:\Program Files\Java\jdk1.8.0_144
JAVA_OPTS
-Xmx1024m -Dsun.lang.ClassLoader.allowArraySyntax=true
MAVEN_HOME
C:\apache-maven-3.5.2
MAVEN_OPTS
-Xmx2048m -XX:ReservedCodeCacheSize=128m -Dsun.lang.ClassLoader.allowArraySyntax=true
MYSQL_HOME C:\MySQL\MySQL Server 5.7 Note:The values for JAVA_HOME, MAVEN_HOME, and MYSQL_HOME variables depend on the location where Java, Maven, and MySQL are installed. This location might differ from the default values provided.
- Select the Path system variable, and click Edit.
- Add the following variables at the end of the Path variable:
- ;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%MYSQL_HOME%\bin;
Tip: Linux Tip
To set the system variables on Linux, modify your .bash_profile in your home folder.
Example
- # .bash_profile
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
- # User specific environment and startup programs
- PATH=$PATH:$HOME/bin
- export PATH
- JAVA_HOME=/home/USERNAME/tools/jdk1.8.0_144
- export JAVA_HOME
- JAVA_OPTS='-Xmx1024m -Dsun.lang.ClassLoader.allowArraySyntax=true'
- export JAVA_OPTS
- MAVEN_HOME=/home/USERNAME/tools/apache-maven-3.5.2
- export MAVEN_HOME
- MAVEN_OPTS='-Xmx2048m -XX:ReservedCodeCacheSize=128m -Dsun.lang.ClassLoader.allowArraySyntax=true'
...
Read more