Introduction to Android development (1) installation and configuration of Java Jdk, androidjdk

Source: Internet
Author: User

Introduction to Android development (1) installation and configuration of Java Jdk, androidjdk

1. First download the latest JDK from www.oracle.com

2. continue to the next step until the installation is complete.

3. Enter the java-version command in CMD. If the correct version number is displayed, the installation is successful.

4. Set the PATH environment variable

After successful installation, we can go to the java jdk installation directory C: \ Program Files \ Java \ jdk1.7.0 _ 79 \ bin in CMD to execute various JAVA commands, for example, JAVAC (compile command)

Wait a moment. Go to the bin directory of the installation directory of java jdk, and run CD... every time ............ Fortunately, Windows has come up with this. As long as we set the environment variable PATH, everything will be done. The same is true for other CMD commands.

Practice: Right-click "computer"-> properties-> advanced system settings-> environment variables-> system variables-> PATH, and add C: \ Program Files \ Java \ jdk1.7.0 _ 79 \ bin

Usage: You can use JAVA to execute commands in any directory of CMD. Enter JAVAC and try again.

5. Set the ClassPath environment variable

Write a Java program to test JDK installation, create the file HelloWord. java, and enter the code in the file

Public class HelloWord
{
Public static void main (String [] args)
{
System. out. println ("HelloWord ");
}
}

 

In the directory of the test program in CMD, enter javac HelloWord. java for compilation. After compilation is successful, one more HelloWord. class will be displayed.

Enter java HelloWord in CMD to run the program successfully. If the program fails to run in other CMD directories, the Class directory is incorrect,

Solution: Right-click computer> Properties> advanced system Settings> environment variables> system variables> ClassPath ), with the directory of the test program added, you can use java to run the program in any directory of CMD.

6. in JAVA, the class name must be the same as the file name

 

 

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.