Android in-depth introduction to the android development environment-JDK (1)

Source: Internet
Author: User

Preface

The android development language uses Java, so we need to install JDK (Java Development Kit) Java Development Kit. Android development uses JDK, therefore, we need to install JDK or a later version on our computer.

Install JDK

After JDK is installed, enter Java-version in DOS. It indicates that the installation is correct. You can see that JDK 1.7 is installed successfully, however, whether the Java file can be compiled depends on the following system environment variable configuration.

Configure Environment Variables

1: Right-click "my computer", click "properties", select the "advanced" tab, and click "environment variables"

2: In "system variables", set three system variables: java_home, path, and classpath (note: "system variables" are useful to all users, "User variables" are only useful to the current login user and are case insensitive to the variables)

2.1: Create java_home and set its JDK installation directory. My directory is c: \ Program Files \ Java \ jdk1.7.0. to configure the java_home variable, the java_home path includes Lib, bin, JRE and other folders, and later with tomcat, eclipse and other Java development software may need to rely on this variable

2.2: Create a classpath and set its value :.; % java_home % \ Lib; % java_home % \ Lib \ tools. jar, when setting the system variable classpath, pay attention to the previous ".; ", configure the classpath variable: Specifies the path of the Java loading class (class or Lib) for the system. Only the class in classpath can be identified by Java commands, % java_home % references the previously specified java_home

2.3: edit the PATH value. % java_home % \ bin; % java_home % \ JRE \ bin. When setting the system variable path (already available in the system), pay attention to the Semicolon "; ", the role of path configuration: path enables the system to identify Java commands in any path

3: Use a smallProgramTest whether jdk1.7 can successfully run the Java program

Write a helloworld. the Java file is as follows, and then enter cd c: \ in DOS to switch to the C root directory and put helloworld. place the Java file in the root directory of the C drive. Because the program cannot be run directly, we must first compile it, that is, input javac helloworld in DOS. java, so that the compilation is completed. If the compilation is not completed, it will prompt an error. After the Java file is compiled, a class compilation file will be automatically generated, for example, then, enter Java helloworld in DOS. class, you will see the output result of "helloworld", so that we have successfully configured the JDK.

Helloworld. Java

Public class helloworld
{

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

Operations under DOS

Final

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.