How to set Path environment variable to Java executable on your machine?


If you want to execute Java programs easily from their current location, you need to include the Java Executable location to the Path Environment Variable. You may either set the User-level Path variable or the System-wide Path variable. If the System-wide Path variable is set, you won't have to do the same for other User Accounts on the machine.


Testsigma Agent is a java program and like all other requires Path variable to be set.



For Windows

After installation, check and copy your java installation location to add it to the Path environment variable. For Java version 8 update 144 on Windows 10, the java installation location is "C:\Program Files\Java\jre1.8.0_144\bin". There might be slight changes in your installation location according to the version of Java installed. That's why it is recommended to check the java installation location before setting the Path variable.


Once you have got the java installation location, you can use the setx command to append the java installation location to the Path variable.


Open Command prompt(CMD) program with Administrator privileges, enter the following command with your java installation location and press Enter key.

setx "%Path%;<java installation location>"


Example:

For Java 8 on Windows 10, the java installation location is "C:\Program Files\Java\jre1.8.0_144\bin"

Therefore the format of the setx command would be 

setx "%Path%;C:\Program Files\Java\jre1.8.0_144\bin"




For Mac/Linux

You can use the locate command as shown below to find Java installation location on your Mac or Linux machine:

locate java


After getting the installation location, append it to the Path variable using the below command:

export PATH=$PATH:/<java_installation_location>



Note: For Mac, you may need to enable locate command by executing the following command in Terminal.

sudolaunchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist


Here's a detailed article on setting up the Environment variables for Java in Windows/Mac/Linux - How do I set or change the PATH system variable?