(i) JDK the download, installation and configuration
1 . Go to Oracle 's official website to download java SE. http://www.oracle.com/technetwork/java/index.html Download the installation after finding the appropriate version of the JDK
2 , installation JDK. You can double-click. The default installation.
3. after the JDK is installed, look at its directory structure under the installation directory.
(ii) Setting environment variables
jdk ms - dos run them at the prompt. Many people may not get used to it, but this is sun deliberately adopted a strategy to devote more effort to the java JDK windows
in Windows For example, explain the setup process. Right-click on the desktop computer icon and choose the properties menu, the System Properties Settings screen will appear, as shown in 1-1.
Figure 1-1
in the " Advanced " tab, click " Environment Variables " button. The environment variables Setting interface appears,as shown in1-2 .
Figure 1-2
( 1 ) New Path environment variables. in the system variables box, select New,as shown in1-3 .
Figure 1-3
( 2 ) Edit Path The environment variable value. Add a value after the PATH variable value:
; C:\Program Files\java\jdk1.8.0_66\bin
figure 1-4
(3) New environment variable " Classpath " , whose value is:
.; C:\Program Files\java\jdk1.8.0_66\lib
when the settings are complete, click"Start"→"All Programs"→"Accessories"→"Command Prompt", or enter commands in the search programs and files:cmd, openDOSwindow, at the command prompt, enter"Java"and the"Javac", after the carriage return, if the usage parameter prompt message appears, the installation is correct,1-5is shown.
Figure 1-5
(iii) Use Notepad Writing Java program
to write Java program, you need to have a text editor. You can use Notepad provided by the operating system as the editor. Write the text on the screen " Welcome to learn the Java language ! " " the file ( Hello.java ).
public class Hello {
public static void Main (String args[]){
System.out.println ("You are welcome to learn the Java language!");
}
}
• Because the execution of a program requires a starting point or a portal, join in the Hello classPublic static void Main (string[] args) {}• The modified Hello.java source file needs to be recompiled, the new class file is generated, and then executed. • The discovery did not compile, but it did not have any effect, because it did not tell the JVM what to do for us, that is, there are no specific statements to execute. • To interact with the JVM, simply add a System.out.println to the Main method ("You are welcome to learn the Java language!"). "), because the program changes, so then recompile, run.
3 . Name the file Hello.java, save it as a text file format file, and note the path to save the file.
Building the Java Environment:
Jre:java the operating environment. jre= Java Virtual machine + core class library (Files run by secondary Java virtual machines)
Jdk:java development tool Set Jdk=jre+java development tools
Note: The path to the JDK cannot be installed with a Chinese path or a space
Description of the JDK directory:
Bin: The Java development tool is stored
Db:jdk7 comes with a lightweight database, named Derby
Include: the interface file that holds the calling system resource
Jre:java Operating Environment
LIB: Core class Library
Src.zip:java Source Code
Common DOS commands:
Action folder:
Dir lists all files and folders under the path where the current console is located
The CD path enters the specified path
Cd.. Fallback to the top level directory
CD \ Fallback to the root directory under the current path
MD Textname Create a folder
Rd Textname Delete an empty folder
Operation Files:
echo Data > file name Create a file and specify the data to write
Type file name to view the specified file contents
Del file name Delete the specified file note: Del is followed by a folder, then delete all files in the folder
* Wildcard Characters
tab content is padded
CLS Clear Screen
Exit Close the console
Java installation, common DOS commands