How many users does Path

How do I set up or change a PATH system variable?


This article applies to:
  • Platform (s): Solaris SPARC, Red Hat Linux, SUSE Linux, Oracle Linux, Windows 10, Windows 8, Windows 7, Vista, Windows XP, Mac OS X

The instructions on this page are for advanced users or system administrators.


General information

  • PATH is the system variable that the operating system uses to look for required executable files from the command line or the terminal window.
  • The system variable PATH can with the System utility in the Windows control panel or in the start file of the Linux or Solaris shell.
  • Changes to the system variable PATH are usually not required on computers on which Windows or Mac OS X is performed.

Windows

Windows 10 and Windows 8
  1. Search in Search, then select: System (Control Panel)
  2. Click on the link Advanced system settings.
  3. click on Environment variables. Look in the section System variables the environment variable and select it. click on To edit. If the environment variable does not exist, click.
  4. Enter in the window Edit system variable (or. New system variable) the value for the environment variable. click on OK. Click to close any remaining windows OK.
  5. Open the command prompt window again and run the Java code.
Windows 7
  1. Right click on the computerIcon on the desktop.
  2. Select the option from the context menu properties.
  3. Click on the link Advanced system settings.
  4. click on Environment variables. Look in the section System variables the environment variable and select it. click on To edit. If the environment variable does not exist, click.
  5. Enter in the window Edit system variable (or. New system variable) the value for the environment variable. click on OK. Click to close any remaining windows OK.
  6. Open the command prompt window again and run the Java code.
Windows XP
  1. Choose begin and then Control panel. Double click system and select the tab Extended.
  2. click on Environment variables. Look in the section System variables the environment variable and select it. click on To edit. If the environment variable does not exist, click.
  3. Enter in the window Edit system variable (or. New system variable) the value for the environment variable. click on OK. Click to close any remaining windows OK.
  4. Open the command prompt window again and run the Java code.


Mac OS X

To run a different version of Java either provide the full path or use the tool:

% / usr / libexec / java_home -v 1.8.0_73 --exec javac -version

Solaris and Linux

  1. To find out if the path is set up correctly:
    In a terminal window, enter:

    This will output the version of the tool if it was found. If it is an old version or the error message Java: command not found is output, the path is not set up correctly.
  2. Find out which Java executable first under PATH Is found
    In a terminal window, type:
Set up PATH permanently

To set up the path permanently, set it in the start-up file.
Note: Instructions for the two most common shells used on Linux and Solaris are listed. If you're using other shells, see the Path Setting Tutorial.

Bash shell

Edit the startup file ()

  1. Change the variable PATH

  2. Save and close the file
  3. Load the startup file
  4. Make sure that the path is set up by using the command
    run again
C shell (csh)

Edit the startup file)

  1. Set up the path
  2. Save and close the file
  3. Load the startup file
  4. Make sure that the path is set up by using the command
    run again