Java development, of course, is the JDK (Java development tools), so today, the installation and configuration of the JDK.
JDK official website (recommended to download, free of charge) http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
First, installation JDK
Choose the installation directory, the installation process will appear two times, installation prompts, the first is to install the JDK, the second is to install the JRE. It is recommended that all two are installed in a different folder in the same Java folder. (cannot be installed in the Java folder root directory, JDK and JRE installed in the same folder will be error)
Second, the environment variable configuration
Computer → properties → advanced system settings → advanced → environment variables
- System variables → new java_home variable, variable value fill in the JDK installation directory (e.g. E:\Java\jdk1.7.0)
- system variable → find path variable → edit at the end of the variable value input%java_home%\bin;%java_home%\jre\bin;
Note : The original path of the variable value at the end of the number, if not, enter the first, and then enter the above code.
- system variable → new CLASSPATH variable, variable value filled in.; %java_home%\lib;%java_home%\lib\tools.jar (Note that there is a point ahead)
Command line Input java-version Verify that the installation is successful
Third, why you need to configure environment variables
PATH environment variable
The function is to specify the command search path, and when executing the command under the shell, it looks in the path specified by the path variable to see if the appropriate command program can be found. We need to add the bin directory in the JDK installation directory to the existing path variable, and the bin directory contains the frequently used executables such as Javac/java/javadoc wait, and after setting the path variable, you can execute the Javac/java tool in any directory.
CLASSPATH Environment variables
The role is to specify the class search path, to use the already written classes, the premise is to be able to find them, the JVM is through the classpth to find the class. We need to set the Dt.jar and Tools.jar in the Lib subdirectory of the JDK installation directory to classpath, of course, the current directory "." must also be added to the variable.
Java_home Environment variables
It points to the JDK's installation directory, and software such as Eclipse/netbeans/tomcat finds and uses the installed JDK by searching for java_home variables.
Iv. the differences between JDK and JRE
The JRE (Java Runtime enviroment) is the Java Runtime environment. For users of Java programs, not developers. If you download and install only the JRE, your system can only run Java programs. The JRE is the set of environments necessary to run a Java program, including the JVM standard implementation and the Java Core Class library. It includes Java virtual machines, Java platform core classes, and supporting files. It does not contain development tools (compilers, debuggers, etc.).
The JDK (Java Development Kit) is the Java SDK, which provides a Java development environment that provides tools such as compiler Javac for compiling Java files into class files, and a runtime environment that provides the JVM and runtime helper packages. Used to parse the class file to get it running). If you download and install the JDK, you can not only develop Java programs, but also have a platform to run Java programs. The JDK is the core of the entire Java, including the Java Runtime Environment (JRE), a stack of Java tools Tools.jar, and the Java Standard Class library (Rt.jar).
The reality of our development is that we have developed our own Java programs using the JDK (calling the Java API), compiled our text Java files into Java bytecode using the compiler program in the JDK (Javac), and run these Java bytecode on the JRE, The JVM parses these bytecode and maps it to a CPU instruction set or system call to the OS.
Java Development Prelude