About environment variable configuration for JDK in Java

Source: Internet
Author: User

About environment variable configuration for JDK in Java
    • Tired of the dead, looking for a long time on the internet. Finally found a way! Now summarize it to help Yimeimei.
Method/Step
  1. 1

    Download the JDK and follow the prompts to install it, and finally note the installation location where the JDK is located, assuming C:\Program Files (x86) \java\jdk1.8.0_20

  2. 2

    Now start configuring environment variables.

    Right click on "Computer", select Properties, click "Advanced System Settings", click on "Advanced", finally click "Environment variable", enter the interface to start the configuration

  3. 3

    Tip: If you select User variables, the variables you configure are only valid for that user

    If you select System variables, it is valid for all users.

    Here we select "System variables".

  4. 4

    We click "New" in "System variables".

    The variable name is: Java_home

    The variable value is: C:\Program Files (x86) \java\jdk1.8.0_20

    Remember, sure.

    PS: Variable value is the path to your JDK installation I'm here for C:\Program Files (x86) \java\jdk1.8.0_20

  5. 5

    We click "New" in "System variables".

    The variable name is: CLASSPATH

    The value of the variable is:.;          %java_home%\lib\dt.jar;%java_home%\lib\tools.jar; (Remember that there's a "." In the front. and a ";").

    PS: Variable value if ".;" It seems to be OK (I have a book like this)

  6. 6

    We find "path" in the "System variables" (we just need to add one).

    Be careful to backup your path before configuring this variable to prevent accidental deletion of!!!!!

    What you need to add is: the JDK installation path plus "\ Bin",

    Like me here is: "; C:\Program files (x86) \java\jdk1.8.0_20\bin" I'm putting him on the last side, if you want to add it to the front: "C:\Program files (x86) \java\ Jdk1.8.0_20\bin; "

    See, actually, there's a change in the position of the semicolon.

    PS: This place to add, I tried a lot of ways on the Internet can not, I have tried their own ideas, the Internet to add to the "JDK installation path +\bin", the result is OK.

    The following is my configuration for reference only:

    C:\Program Files (x86) \nvidia Corporation\physx\common; C:\Program Files (x86) \microsoft DirectX SDK (August) \utilities\bin\x86;%systemroot%\system32;%systemroot%;% systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0; C:\Program Files (x86) \java\jdk1.8.0_20\bin

  7. 7

    After configuration, come to the CMD interface and enter "Java" and "Javac" to see if the configuration is successful!

    In fact, as long as the "Java_home" and "CLASSPATH" configuration is correct, the JAVA command will succeed, if the "path" configuration has a problem, the Javac command will fail.

    END
My understanding of the environmental variables
    1. 1

      The so-called environment variables, rough Understanding is the shortcut:

      If we want to enter only Xxx.exe in cmd, we can use it in C:aa\bin\xxx.exe

      Then we only need to add the path behind the configuration of the environment variable; c:aa\bin (be sure to add it in front; (using English characters) to separate the contents of the previous path, without spaces). This means that when we enter Xxx.exe in CMD, the system goes to the folder to find the program.

      END
experience content is for reference only, if you need to solve specific problems (especially in the areas of law, medicine, etc.), we recommend that you consult the relevant professionals in detail. ReportAuthor's statement: This experience is based on the actual experience of the original, without permission, declined reproduced.

About environment variable configuration for JDK in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.