Step 2. install Java Develop Kit (JDK)Sun provides a free Java Development and running environment for all Java programmers, named Java2 SDK, which can be downloaded from the http://sun.com. During installation, you can choose to install it on any hard drive, for example, to the D:/jdk1.6 directory. The JDK directory contains sub-directories such as bin, demo, Lib, and JRE. The bin directory stores command files such as javac, Java, and appletviewer. The demo directory stores many Java examples, the lib directory stores the Java class library file, and the JRE stores the Java Runtime Environment. Download path: http://java.sun.com/javase/downloads/index.jsp (download the latest JDK for windows, the latest JDK 6 Update 2 (about 65m): http: // 192.18.108.145/ECOM/ecomticketservlet/combine/-2147483648/2365720779/1/838358/840458/2365720779/2ts +/westcoastfsend/jdk-6u2-oth-JPR/jdk-6u2-oth-JPR: 2/jdk-6u2-windows-i586-p.exe)
Step 2. Configure Environment VariablesRight-click "my computer" ---- "properties" ----- "advanced" ----- "environment variable". In the "environment variable" window, enter the following key in the user variable:
| Variable name |
Variable value |
| Java_home |
C:/j2sdk1.4.1 _ 02 // JDK installation path |
| Path |
.; % Java_home %/bin |
| Classpath |
.; % Java_home %/lib/tools. Jar |
(Explains the roles of path and classpath)
Step 1 test whether the Java environment is completeA. in the DOS window (CMD), type the command "Java-version ". press enter to display the following information, indicating that the path value is set correctly Java version "1.6.0-RC" Java (TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b66) Java hotspot (TM) client VM (build 1.6.0-rc-b66, mixed mode, sharing) if the following information is displayed, you need to check that the PATH variable 'java' is not an internal or external command, it is not a running program or batch processing file. B. open notepad, type the following code, and save it in D:/Java/hello. java (create the folder by yourself). Note: The file suffix is. java, not TXT. class Hello {public static void main (string ARGs []) {system. out. println ("Hello World") ;}} C. compile and type the following commands in the DOS window (CMD), and observe the changes in the Java folder after completion. D: CD Java javac hello. java (if the following prompt is displayed, check whether the PATH environment variable or command is correctly typed: 'javac' is not an internal or external command, it is not a running program or batch processing file .) D. run the following commands in the DOS window (CMD): Java hello, if displayed: Hello world, the configuration is correct; otherwise, check classpath E. after modifying the program, we can modify hello. in the Java main function, recompile and run the statements and observe the differences between folders or display. Step 4: Download the JDK help document. The JDK help document is a very useful document describing many built-in JAVA functions, including class, package, interface and other API help. (We can easily check the usage of a class during development, similar to Microsoft's msdn. In the future, I will demonstrate how to view these documents) we recommend that you download both Chinese and English versions. Check the English JDK Doc. java help documentation (jdk6) English: http://java.sun.com/docs/windows_format.html Chinese (currently not complete, we recommend that you download English edition): http://download.java.net/jdk/jdk-api-localizations/jdk-api-zh-cn/publish/1.6.0/chm/JDK_API_1_6_zh_CN.CHM