Java learning diary-1 Set Java environment variables and so on, java environment variables
I. Setting Environment Variables
After jdk is installed, You need to configure the environment variables and find [my computer]-[properties]-[advanced]-[environment variables]
Three environment variables need to be configured here
1. Create a system variable JAVA_HOME. The variable value is the jdk installation path, for exampleC: \ Program Files \ Java \ jdk1.7.0 _ 51
2. Create or modify the system variable Path (windows is case insensitive). Add % JAVA_HOME % \ bin after the variable value;
Note:You do not need to set the classpath variableAlternatively, as long as your JDK version is later than 1.4, JRE will automatically search for class files in the current directory and use Java's compilation and running tools. The system can automatically load dt. jar and tools. java class in the jar file. Therefore, you only needBin directory of JDKAfter being added to the path variable, you can run the java program o (export □taobao) o. You are too lazy to create JAVA_HOME. just copy the Path to the path.
Ii. Common doscommands
1. dir (display the file name in the current directory)
2. c/d/e/f: (directly go to the c/d/e/f disk. It can be case sensitive)
3. md (make directory creation directory)
Md mydir (create the folder mydir in the current directory)
Md mydir \ mydir2 (create the mydir2 sub-folder under the folder mydir ).
4. cd (change the current directory, followed by the path, and the two special paths... are the current directory and the upper-level directory respectively)
Cd + drive letter (display the current directory of the disk) for example: cd d:/c:
Cd + path (change the current directory to the path) cd users/aaa
5. copy the source file name to the target file name (copy the content of the original file to the target file)
Format: copy [Source disk] [path] (source file name) [target disk] [path] [target file name]
Note: (1) Old files with the same file name on the target disk will be replaced.
(2) wildcards */?, Multiple files can be copied at the same time (* represents any text ,? Represents a single character)
(3) If the target file name is the same as the source file name, the target file name can be omitted.
(4) copy [Source disk] [path] (source file name 1) (source file name 2) (source file name 4) the [target disk] [path] [target file name] can be used to merge files.
6. xcopy)
Format: [Source disk] (Source Path Name) [target disk Letter] [target path] [/s] [/v] [/e]
Note: (1) Copy all files in the source directory and Its subdirectories (if/e is not available, do not copy an empty directory)
(2)/e copy together with an empty directory
7. type (displays the content of a text file consisting of ASCII codes. The file name must contain an extension)
Type mytext.txt
8. del (delete files)
Followed by the file path name. Wildcards can be used.
9. tree (display the disk directory structure)
The directory structure under the path is displayed, and the structure under the current directory is displayed if the path is not followed.
10. echo (write content, create file)
Echo abc> a.txt (create a text file a.txt and write abc ).
Iii. Java program running mechanism java source file (. java) --> bytecode file (. class) --> the first conversion of the machine code is performed by javac, and the second conversion is completed by JVM (Java Virtual Machine). 4. JDK, JRE, and JVMJDK, full name: Java SE Development Kit, java standard development kit JRE, full name of Java Runtime Environment, Java Runtime Environment JVM, full name of Java Virtual Machine, Java Virtual Machine JRE contains JVM and other Environment support for running Java programs, after JDK is installed, it contains JRE 5 and the following bin directory under the JDKJDK path: It stores various JDK commands, such as common javac and java commands db: Java DB path jre: JRE environment lib: the actual execution program of JDK tool commands src: source code of all Java core Class Libraries