Java Learning Summary (i)

Source: Internet
Author: User

1. Overview 1.1 DOS command line-common commands

L dir: Lists the files and folders in the current directory

L MD: Create directory

L RD: Delete directory

L CD: Enter the specified directory

L CD. : Back to the top level directory

L cd/: Go back to the root directory

L del: Delete files

L Exit: Launch DOS command line

L echo xxx> filename.txt outputs content to a file in the current directory

L del: Delete files

L C: Switch to the established drive letter (e.g. D: Switch to D-drive)

1.2 Three-technology architecture of the Java language 1.2.1 J2se (Java 2 Platform Standards Edition) Standard Edition

is a solution for developing common desktop and business applications.

The technology system is the basis of the other two, can be completed some desktop application development.

1.2.2 EE (Java 2 Platform Enterprise Edition) Corporate Edition

is a set of solutions for developing applications in an enterprise environment.

The technologies included in the technology system, such as Servlet JSP, are mainly for Web application development.

1.2.3 J2me (Java 2 Platform Micro Edition) Small edition

It is a solution for the development of electronic consumer products and embedded devices.

The technology system is mainly used in small electronic consumer products, such as mobile phone applications.

1.3 Java language Environment 1.3.1 What is JRE,JDK?

L JRE (Java Runtime Environment Java Run environment)

including Java virtual machines (JVM Java) and the core class libraries required by Java programs, if you want to run a well-developed Java program, you only need to install the JRE on your computer.

L JDK (Java Development Kit Java Development Kit)

The JDK is available to Java developers, which includes Java development tools and the JRE. So with the JDK installed, you don't have to install the JRE separately. Development tools: Compilation Tools (Javac.exe) packaging Tools (Jar.exe), etc.

1.3.2 Configuring environment variables

If the currently executing program is not present in the current directory, the Windows system looks in the directory specified by an environment variable named path that is already in the system. If it is not found, a "not a running application or batch questionnaire" error message appears.

Depending on how the Windows system looks for executable programs, you can define the path where the Java tools are located in the PATH environment variable, and let the system help us find the program that runs the execution.

The steps are as follows:

My Computer--Properties--advanced--environment variables

Edit the PATH environment variable, and at the beginning of the variable value, add the directory where the Java tool is located (example: C:\Program Files (x86) \java\jre6\bin), followed by ";" Separated from other values.

Temporary configuration: Completed by the SET command in DOS command

set: Information that is used to view all environment variables for this computer.

Set Variable name: View the value of a specific environment variable.

Set Variable name =: Clears the value of an environment variable.

Set Variable name = specific value: Defines the specific value for the specified variable.

Want to add a new value based on the original environment variable value?

• First, the value of the original environment variable is obtained by the% variable name% operator.

• Then add the new value and define it to the variable name

• Example: Adding a new value to the PATH environment variable

set path= new value;%path%

Note: This configuration only works in the current DOS window. The window closes and the configuration disappears.

In order not to change the value of path continuously because of the directory or directory name of the JDK, the error of the value of the path variable can be done by the following techniques.

• Create a new environment variable Java_home record the directory of the JDK.

• Get the value of Java_home dynamically in path with a percent change.

java_home=f:\jdk1.6.0_01

path=%java_home%\bin;%path%

%path%: Dynamically gets the value of the PATH environment variable.

%java_home%: Dynamically gets the value of the name java_home environment variable

Since the class file (bytecode file) is Java's running file, can it be implemented, in any directory will be able to execute a directory of the class file?

Depending on the principle of the PATH environment variable, you can define an environment variable named CLASSPATH, which is defined in the same directory as the class file that will run.

Example: Set Classpath=c:\

Classpath variable value is a directory of Java class files

Path variable is a directory of Windows program files

The order in which the JVM looks for class files:

• If the CLASSPATH environment variable is not configured, the JVM looks for the class file to run only under the current directory.

• If the CLASSPATH environment is configured, the JVM will first look for the class file to run in the directory of the CLASSPATH environment variable value.

• If a semicolon is added at the end of the value, the JVM does not find the class file to be specified in the Classpath directory, which is looked up in the current directory.

• The end of the value if there is no semicolon, the JVM does not find the class file to be specified in the Classpath directory and does not look in the current directory, even if it is present in the directory.

• Recommendation: When configuring the CLASSPATH environment variable, do not add a semicolon at the end of the value, or use "." If you need access to the current directory. Said.

The complete path setting is as follows:

Set java_home=c:\jdk1.5.0_06
Set path=%java_home%\bin;%path%
Set classpath=.; %java_home%\lib;%java_home%\lib\tools.jar

1.3.3 Java Programming Experience

1. Write the Java code in a file with a. java extension.

2. Compile the Java file with the Javac command.

3. Run the generated class file with the Java command.

The flowchart is as follows:

Example code:

/**

Author:hxf

Createddate:2015-05-31

Description:hello world!

*/

Classhelloworld

{

public static void Main (string[] args)

{

System.out.println ("helloworld!");

}

}

Java Learning Summary (i)

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.