[Java4android] Settings for JDK environment variables under Win7

Source: Internet
Author: User

video from:http://www.marschen.com/

The JDK isn't as smart as Microsoft Camp VS, and everything is ready for you when it's installed, and we don't have to manually configure a lot of things.

First of all, why configure the JDK environment variable to identify Java commands and Java classes under any path

The configuration is divided into 2 parts, 1,java the command path. 2,java Load Class

It is divided into 3 steps, first set a total path of Java Java_home, then set the command path, then the load classpath classpath

1. Configure Environment variables

First open the WIN7 environment variable--right-My Computer Properties-Advanced environment settings (on the left)--click Environment variables

1) java_home indicates the JDK installation path, which is the path D:\javar\java\jdk1.6.0_25 selected at the time of installation, including the Lib,bin,jre folder (this variable is best set, since Tomcat is run later, Eclipse and so on need to be dependent on this variable);

2) path allows the system to identify Java commands under any path, set to:

%java_home%\bin;%java_home%\jre\bin

3) classpath is the Java load class or lib path, only the class is in Classpath, the Java command is recognized and set to:

.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar (to Add. Indicates the current path)

%java_home% is referring to the previously specified java_home;

(My general habits like to modify user variables rather than system variables, because I have only one account, there is no problem of switching accounts, so set the user variable is enough, but also to avoid some of the software automatically set system variables of the conflict)

This allows the environment variable to be set after win

2. Test environment variables

First in run or win+r, type cmd

Type the command "Java-version", "Java", "Javac" a few commands, the screen shows that the environment variable configuration is successful;

Java–version

Java

Javac


If the 3 echo message is this, then you've set it up successfully

But a lot of people make such a mistake.

"Input Javac carriage return" Prompt "Javac is not an internal or external command

My Win7 also appeared this problem, this is the cmd update inconsistent problem, close the cmd window, the new open is good, of course, if you set the environment variable is OK, if the new open cmd or not, then your path path is not set, carefully check it

Test environment WIN7-64-SP1

 

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.