Elastic Path Commerce Development

Configuring System Environment Variables

Configuring System Environment Variables

Use this procedure to set system environment variables for:
  • Java JAVA_HOME and JAVA_OPTS
  • Maven MAVEN_HOME and MAVEN_OPTS
  • MySQL MYSQL_HOME
.
  1. Open the Start menu, right-click Computer and select Properties.
    Tip: To quickly show the System Properties > Advanced > Environment Variables from the Windows Run prompt, type SystemPropertiesAdvanced.
  2. Click Advanced System Settings.

    Ev2.png

  3. In the System Properties > Advanced window, click Environment Variables.

    Ev4.png

  4. To add a new system environment variable, on the Environment Variables window, click New.
  5. Add the following:
    Variable Name Variable Value

    JAVA_HOME

    C:\Program Files\Zulu\zulu-8-amd64

    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.
  6. Select the Path system variable, and click Edit.
  7. 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 as shown in this 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/zulu-8-amd64/
    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'
    export MAVEN_OPTS
    PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
    export PATH
For Macintosh OS X development environments with multiple Java versions installed, set JAVA_HOME to use the Zulu OpenJDK Java 8u202 using the following commands:
# Example location of a non-Zulu Java JDK:
/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home

# List all Java installations:
/usr/libexec/java_home -V
  11.0.1, x86_64:                    "Java SE 11.0.1"  /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
  1.8.0_202-zulu-8.36.0.1, x86_64:   "Zulu 8"          /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home

# Set JAVA_HOME to the Zulu OpenJDK to 1.8.0u202 installation:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_202-zulu-8.36.0.1`

# Check and verify
java -version
  openjdk version "1.8.0_202"
  OpenJDK Runtime Environment (Zulu 8.36.0.1-CA-macosx) (build 1.8.0_202-b05)
  OpenJDK 64-Bit Server VM (Zulu 8.36.0.1-CA-macosx) (build 25.202-b05, mixed mode

# Confirm JAVA_HOME is now set to Zulu OpenJDK 1.8.0u202:
echo $JAVA_HOME
  /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home