Step by step to bring you into the Java World (1) _ Java environment Configuration

Source: Internet
Author: User
ArticleDirectory
    • 1. Introduction to Java
    • II. Environment Configuration
1. Introduction to Java

The introduction to Java is everywhere on the Internet. I will not elaborate on it here, but one thing must be mentioned:
That is the definition of Java in Sun's Java White Paper:Java: A simple, object-oriented, distributed, robust, secure, architecture-neutral, portable, high-performance, multi-threaded, and dynamic language.

The translation is: Java is a simple, object-oriented, distributed, robust, secure, structure-neutral, portable, and efficient, multithreading and Dynamic Language. In the future, we will learn about these features of the Java language.

II. Environment Configuration

To learn Java, you must first configure the Java Runtime Environment. Before configuring the environment, let's first understand the concept:JDK (Java Development Kit).
JDK is the core of the entire Java, including the Java Runtime Environment (Java runtime envirnment), a bunch of Java tools and the Basic Java class library (RT. Jar ). No matter what Java application server is actually built into a certain version of JDK. Therefore, mastering JDK is the first step to learn java well. The most popular JDK is the JDK released by Sun. In addition to sun, many companies and organizations have developed their own JDK, such as JDK developed by IBM and jrocket of Bea, and JDK developed by GNU. Although there are many JDK, here we mainly target Sun JDK. The JDK mentioned below also specifically refers to Sun's JDK.

JDK is also called j2se (Java2 SDK Standard Edition), can be downloaded from Sun's Java website, http://java.sun.com/javase/downloads/index.jsp, JDK is the latest version of jdk1.6.0.

The downloaded JDK is an executable installation.Program, Jdk-6-windows-i586.exe

Double-click installation:

Click "accept"

Change the installation path to c: \ jdk1.6.0.

All the way to "Next ".

After JDK is installed, set the environment variables:

Right-click my computer and select "properties ".

Select the "advanced" tab.

Go to environment variable settings:

Set the following three environment variables:
Path = c: \ jdk1.6.0 \ bin
Classpath = .; % java_home % \ Lib \ tools. jar; % java_home % \ Lib \ DT. jar (note that there is a ". ", indicating the current directory)
Java_home = c: \ jdk1.6.0

After setting, let's test it. Start-run, enter "cmd", and press Enter.

Enter "Java-version" in the DOS command window and press Enter.

If the JDK version is displayed as shown in the following figure, the "path" variable setting is correct. If any, check the PATH variable setting and enter "Echo % PATH % ".

Check whether "C: \ jdk1.6.0 \ bin" exists ". If it does not exist, return to the environment variable settings for check.

Next we will write a simple Java program to test whether classpath is set correctly.

Open notepad, enter the following content, and save it to the C: \ Java directory. The file name is helloworld. java. (Case Sensitive)

Class helloworld {
Public static void main (string [] Arg ){
System. Out. println ("helloworld ");
}
}

In the open doscommand window, enter c: \ Java, enter "Java helloworld. Java", and press Enter.

A "helloworld. Class" file is added to the C: \ Java directory.

In the doscommand window, enter "Java helloworld" and press Enter.

If the program is correct, "helloworld" will be output ".

Congratulations, your Java environment has been configured successfully.

 

FAQs:

1. A program or batch processing file similar to the following occurs: 'java' is not an internal or external command, nor is it a runable program or a batch processing file.

Check whether the path settings in the environment variables point to the bin directory under the JDK installation directory.

 

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.