Install JDK in Java and configure the path and classpath Environment

Source: Internet
Author: User

1. The first step is to go to the next Java JDK. At present, the latest version of Java JDK should be JDK 7.0, so I went to Baidu and found it on many websites.

2. The second step is to install the JDK Virtual Machine and follow the prompts in it. You can install C or other disks (such as D) with two programs. For example, I installed JDK in the path D: \ It \ JDK. The procedure is as follows:

Click "accept ",

Select path D: \ It \ jdk6.0 and click "OK ",

Install JRE of this version below

After selecting the path, click "Next ",

After the installation is complete, click "finish ".

The installation process may take a long time. Please wait patiently ......

3. Now, if you press "Open Control Panel \ Program \ function \ Uninstall program", you will see Java (TM) se Development Kit 6 kit Update 2 and Java (TM) 6 Update 2 have been installed successfully. If you have already followed eclipse, you can directly use eclipse to write code and run it normally.

4. If you do not install eclipse but use a command prompt to compile and run it or want to further set the environment configuration of the path and classpath, take a look at the steps below:

(1) Find the binfolder in the root directory of the installation, that is, the path of the javac.exe file,If your installation path is D: \ It \ jdk6.0 \ Java (TM) se Development Kit, you only need to find D: \ It \ jdk6.0 \ Java (TM) se Development Kit \ bin, you can see the javac.exefile and java.exe File.(In addition, if it is a Windows 7 Creation System, install Java
After JDK, a jdk file is automatically generated on the C drive, and the path of the javac.exe file is also located in it. For example, (my own file is c: \ JDK \ bin), CTRL + C copy path, and right-click "computer \ properties ", select "System Properties \ Advanced", for example:

Click "environment variable", find "path" in "system variable", double-click it, and position the cursor to the leftmost end in the "variable value" box, paste the copied path to it. For example:

Remember to add a semicolon ";" and then click "OK" and "OK". The configuration is complete.

(2) check whether the environment configuration is correct. Open the command prompt "Start \ Program \ attachment \ command prompt", or right-click "start" and enter "cmd" in "run" to investigate the command prompt. Open the command prompt and enter: javac, if:

The configuration is correct.

(3) configure the classpath path. The classpath path is the path that the system will find during compilation (running. If you write a Java program in E: Java, you can set it as follows:

Right-click "computer \ properties", select "System Properties \ Advanced", find "classpath" in "system variables", (create a classpath if not), and double-click it, in the variable value box, move the cursor to the leftmost end and set the path to "E: \ Java ;. ". For example:

Note that a semicolon is followed by a dot ";.", which means to set it to the current path. (After adding a dot, You can compile the ". Java" file in the E drive, or the ". Java" file in the D Drive, drive C, and drive F)

For example, you have written a helloworld in the E: Java directory. to compile and run the Java file, open the command prompt and enter "E:", "CD Java", and "javac helloworld. java. If the compilation is normal, E: \ Java will appear in the next line, and "Java helloworld" will be entered. The operation is normal and "Hello World!" will appear! ". For example:

 

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.