Java Learning First step--JDK installation and Java environment variable configuration

Source: Internet
Author: User
Tags exit in windows x64

Java as the current mainstream programming language, Learning Java friends are more and more, as an object-oriented programming language, Java also has a lot of security, high efficiency and so on. From Tiobe (Tiobe leaderboard is based on the number of experienced programmers, courses and third-party vendors on the Internet, and uses search engines (such as Google, Bing, Yahoo!, Baidu) and Wikipedia, Amazon, YouTube to figure out ranking data, Just reflecting the popularity of a programming language does not explain how well a programming language is, or how much code is written in a language. In the rankings, the April and May data analysis, the Java language second only to the C eldest, stable ranking second, the results are impressive.

Before the tribe QQ group 172437052 There are many beginners in the installation and configuration of the JDK encountered trouble, resulting in the Java learning process can not continue, today, the tribe to bring you a detailed JDK (Java development Kit, Java Language software Development Kit) installation and configuration tutorials for Java environment variables. (PS: Veteran, please drift, this tutorial only for Java Novice)

First, download and install the JDK

Baidu search keyword "jdk download" to enter the Oracle official website (Java originally belongs to Sun company, Sun Company in April 2009 20 by Oracle Oracle Company acquired, so now Java belongs to Oracle Company).

After entering the website, download the latest version of the JDK. Such as:

Click Download JDK link, enter the download selection screen, check the acceptance License Agreement (accept the terms of service), remember to accept the terms of the radio button must be selected to download Oh. Then according to your computer's operating system, select the corresponding version of the JDK, such as the small computer is Windows 64-bit, then I should download the Windows x64 version of, for example, downloaded to the computer.

After downloading to your computer, run the Setup program.

Then, next, the installation path is followed by the default C-Drive Program Files folder under the Java folder, others are also default, such as:

Then click Next to automatically enter the installation link. You will then be prompted to choose the installation environment for the standalone JRE (Java runtime Environment,java Runtime), or still follow the default, to the folder under Program files for C, such as:

Finally, you will be prompted with the following installation success:

Click the Close button to complete the installation. At this point, the JDK is installed successfully.

Second, the configuration environment variable and classpath value

If you want to configure environment variables after installing the JDK, many Java beginners or friends who have learned Java may not be able to answer them completely. In fact, the so-called environment variable is an object with a specific name in the operating system that contains the information that one or more applications will use. For example, the PATH environment variable in Windows and DOS operating system, when the system is required to run a program without telling it the full path of the program, in addition to the current directory in the search for this program, but also in path specified in the path to find. The user can run the process better by setting the environment variables. Therefore, if after installing the JDK, do not configure the Java environment variables, then, under the DOS command line environment, can not find the Java compiler program and Java running program, it can not be in the DOS environment under the Java compilation and running program. Classpath is the "class" path, and the purpose of setting up classpath is to tell the Java execution Environment which directories can find the classes or packages that you need to execute the Java program. All right, nonsense. The following describes how to configure the Java environment variables and classpath values.

First, find the installation directory for your JDK just now, for example, in this article, the JDK for the small computer is just installed in the C:\Program Files\Java\jdk1.8.0_05 directory:

Then, go back to the desktop, computer-right-click Properties, and then select Advanced System settings on the left, such as:

To enter the environment variable settings, you can click the Add button below to add the relevant environment variables, you can also delete and modify the existing environment variables:

Next, we click on the Add button above, add a environment variable named Java_home, corresponding to the environment variable value for you just installed the path of the JDK, for example, the Java_home value of the small series: C:\Program Files\Java\jdk1.8.0_05 . Such as:

Once the input is complete, click Save to save the JAVA_HOME environment variable. Then, locate the environment variable named path in the system variable, select it, and press the Edit button:

Add the following value at the end of the PATH environment variable: ;%JAVA_HOME%\bin (preceded by a semicolon), such as:

Note here that the value in the PATH environment variable is delimited by a semicolon, so, when you add the JAVA_HOME environment variable at the end, you must remember to separate it with a semicolon, where%java_home% represents the JAVA_HOME environment variable value you previously configured, so that If the next JDK location changes, just modify the JAVA_HOME environment variable value.

Finally, you need to add the CLASSPATH environment variable.

Create a new environment variable named Classpath, and then enter the following value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; (preceded by a dot and a semicolon oh, the dot represents the current path) and then click Save:

Finally, click on the confirmation in the window and exit in turn. After exiting press Windows key +r, enter CMD to run the DOS window, enter the command in the window: javac -version (note, here is the Javac command, which is a compiler command in Java,-version to view the version information)

At this point, the JDK and Java environment variables have been all well done ~ ~ ~ Then there is a "difficult" task, that is--write a Hello World program ... (not a classic word called "Every master is from Hello World start ~ ~"), come on, come on! To commemorate this great era, as well as the hard-won installation of JDK and config environment variables, I don't think today will let everyone output a "Hello world!" , and, instead, output two "Hello world!". ^_^

Create a new file named Hello.java save to the root of the D drive. Open with text editing software and type the following:

code
12345 public class hello {      public static void main (string[] args) {           system.out.println ( "Hello world! Hello world! "      } }

In the DOS console, switch to the D drive with the command: D: , and then, type the Java compile command: javac Hello.java . After compiling, you will find that the D drive has more than one Hello.class file, which is the bytecode file compiled by Java.

Next, continue to enter the command in the console: java Hello (note that the Javac command is not used here, the Java command is to execute the command, and there is no suffix after hello. Class), if you see the console output two Hello world! then, it means, Your Hello world is finished.

congratulations! This is just a beginning~~ start your Java learning path

Summarize

Coding is easy, debugging bugs is not easy, and the compilation and cherish.

Direct configuration of MYECLIPSE2014 's own JDK

There's actually a lazy way, Because MyEclipse2014 comes with a JDK1.7, if you have installed MyEclipse2014 of small partners, you can not download the installation JDK, directly configure the MyEclipse2014 from the version of the JDK, the path of the JDK is:[MyEclipse2014路径]\binary\com.sun.java.jdk7.win32.……

For example, the MyEclipse JDK path for small series, such as:

Then, on my computer should follow the above configuration steps, just to change the value of Java_home, the D:\Program Files\MyEclipse Professional 2014\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45 other.

Copyright belongs to: Eclipse Tribe-MyEclipse Chinese web

Original address: http://blog.my-eclipse.cn/jdk-install-classpath.html

The original source and this statement must be indicated in the form of a link when reproduced.

Java Learning First step--JDK installation and Java environment variable configuration

Related Article

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.