1. Download
Http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe
2. Set three environment variables
For Windows or Windows XP, right-click my computer and choose Properties> advanced> environment variables.
System variable-> New-> variable name: java_home variable value: C:/jdk1.6.0 _ 21/
System variable-> New-> variable name: classpath variable value:.; % java_home % \ Lib \ tools. Jar
System variable-> edit-> variable name: path is added at the beginning of the variable value: % java_home % \ bin; % java_home % \ JRE \ bin
(Classpath has an English ending "." followed by a semicolon, indicating the meaning of the current path)
Java_home indicates the JDK installation path, which is the path selected during the installation (assuming that the JDK is installed on D:/jdk1.4). This path includes Lib, bin, JRE and other folders (it is best to set this variable, because Tomcat and eclipse will all depend on this variable in the future ).
Path specifies the tool program path, set to: % java_home %/bin; % java_home %/JRE/bin
Classpath is the path of the Java loading class (class or Lib). Only the class in classpath can be identified by Java commands and set :.; % java_home %/LIB; % java_home %/lib/tools. jar (to add. indicates the current path)
In fact, JDK will look for Java programs in the current working directory and JDK lib directory. Therefore, if the Java program is in these two directories, you do not need to set classpath.
You need to restart the machine after setting
Content in the JDK installation directory
Bin directory: JDK tools, javac, Java, javadoc, appletviewer, etc.
Demo Directory: Java demo program
JRE Directory: JDK's built-in JRE
Lib directory: Java tool class (for example, the javac tool program will actually use the COM/Sun/tools/javac/main class in tools. Jar), which will be used for both compilation and execution.
Src.zip: source code compressed file of the API class provided by Java
3. Test it.
After the configuration is complete, open CMD and enter the command: Java-version to view the JDK version information. If it is output correctly, the configuration is successful.
4. instance Program
(1) create a text file helloworld. Java
/* Helloworld. Java */
Public class helloworld {
Public static void main (string Arg []) {
System. Out. println ("Hello, world! ");
}
}
Note: The file name must be exactly the same as the class name (including case sensitive)
(2) open a DOS window and jump to the directory where helloworld. Java is located.
C:/> Cd/test
(4) Compile helloworld. Java as helloworld. Class.
C:/test> javac helloworld. Java
(4) Run helloworld. Class
C:/test> JAVA helloworld
Hello, world!
5. Public and private JRE
In the Java root directory, the common JRE mainly provides the execution platform for the developed Java program.
Private JRE is the JDK's own JRE. It is under the JRE directory under the JDK installation directory for testing during Java program development.
The main difference between the two is that private JRE has more sever VM (Virtual Machine) Execution options than public JRE.
6. Java program considerations
(1) The source program extension must end with. Java
(2) The main file name must be the same as the main class name, case sensitive
(3) Java case sensitivity
7. Editor
(1) utrledit
(2) eclipse
Open source code, Java-based scalable platform. It is a framework and a group of services used to build a development environment through plug-ins and components. Comes with a standard plug-in set, including Java development tools (jdt)
It also includes the plug-in Development Environment (plug-in development environment, PDE) for developers who want to expand eclipse
The same plug-in mechanism can be used to increase support for different languages. To develop a Java program, use the jdt plug-in included in eclipse. To develop programs in other languages, you need to obtain other plug-ins, such as CDT (C Development Toolkit) to develop C/C ++ programs.
(3) myeclipse
Myeclipse is an Eclipse plug-in. It is a powerful J2EE integrated development environment that supports code writing, configuration, testing, and debugging.
(4) JBuilder, Borland
(5) netbean, sun
(5) visualage for Java, IBM
(6) cafe and Kawa
8. decompilation Tool
Javap java. AWT. Button
Lists the public methods and Public member variables in a button.
Javap-Private java. AWT. Button
Lists all methods and member variables in a button.