how to set environment variables in windows code example

Example 1: gat environment variables java

String environmentVariable = System.getEnv("environment_variable_name"); 
//You can create environment variables on your computer manually
//and then you must put the environment variable in the parantheses as a String

Example 2: set path in windows

set path=C:\Program Files\Java\jdk1.6.0_23\bin

Example 3: set environment variable windows command line

setx EC2_CERT "%USERPROFILE%\aws\cert.pem"

Example 4: how to change environment variables in windows 10

Open the Start Search, type in “env”, and choose “Edit the system environment variables”: