Environment variables for java installation

后端 未结 14 1015
清歌不尽
清歌不尽 2020-11-22 00:52

How to set the environment variables for Java in Windows (the classpath)?

14条回答
  •  伪装坚强ぢ
    2020-11-22 01:10

    --- To set java path ---

    There are two ways to set java path

    A. Temporary

    1. Open cmd
    2. Write in cmd : javac

    If java is not installed, then you will see message:

    javac is not recognized as internal or external command, operable program or batch file.

    1. Write in cmd : set path=C:\Program Files\Java\jdk1.8.0_121\bin
    2. Write in cmd : javac

    You can check that path is set if not error has been raised.

    It is important to note that these changes are only temporary from programs launched from this cmd.

    NOTE: You might have to run the command line as admin

    B. Permanent

    1. Righ-click on "My computer" and click on properties
    2. Click on "Advanced system settings"
    3. Click on "Environment variables"
    4. Click on new tab of user variable
    5. Write path in variable name
    6. Copy the path of bin folder
    7. Paste the path of the bin folder in the variable value
    8. Click OK

    The path is now set permanently.

    TIP: The tool "Rapid Environment Editor" (freeware) is great for modifying the environment variables and useful in that case

    TIP2: There is also a faster way to access the Environment Variables: press Win+R keys, paste the following %windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables and press ENTER

提交回复
热议问题