I found that many people around me who learn Java like me can basically configure the Java Development Environment at any time, and some people still need to read the previous notes for configuration. I'm surprised that, this includes people who can easily configure the Java development environment without taking notes. They just remember how to configure the environment and do not really know why to configure it like that. Some people think that this is not necessary to know, as long as the environment is configured, but is it good for a person who really wants to learn Java or want to engage in this line? This is not feasible. Since we plan to learn to do it, we must be a more real technician for some knowledge. Therefore, do not ignore the details of what we have the ability to understand.
1. JDK
The full name of JDK is Java SE Development Kit, which is the Java standard Development Kit. It is a set of Development kits provided by Sun for developing Java applications, it provides various tools and resources required to compile and run Java programs, including the Java compiler, Java Runtime Environment, and common Java class libraries. Therefore, you must install JDK before developing Java programs.
But now there is a problem: After JDK is installed on the Local Computer, can we compile and execute the Java program directly on the console?
Obviously, the command console does not know the JDK installation path and cannot find the tools and resources for compiling and executing programs. Therefore, we must configure our development environment, the so-called development environment tells the system the path of various tool commands for compiling and executing Java programs, and the system can find these tools to compile and execute programs.
So how do I configure the JDK installation path? What are the specific paths for the system? First, let's look at some directories under JDK.
Bin: This directory stores various JDK tool commands, such as javac and java.
Db: the path for installing Java DB
"Jre: The runtime environment required to run the Java program is installed in this path.
Lib: This path stores the actual execution program of the JDK command, or the Jar package.
Demo: stores the demo code provided by JDK.
2. Set the PATH environment variable
The following two steps must be taken to compile and execute a program on the console:
1) Compile the source file into bytecode and use the javac command)
2) explain how to use java commands to execute platform-independent bytecode programs)
The above two steps require the use of javac and java commands, although we have installed JDK on the computer, and the JDK directory also contains the java and javac commands, but now the computer does not know where to find these two commands.
How do computers find commands?
In windows, the Path in the environment variable is case-insensitive. The value of the Path environment variable is a series of paths.
Therefore, we need to add the full Path of the bin directory under the jdk directory because the bin contains various command tools to the Path environment variable. In this way, when we execute commands such as javac and java again on the console, the computer can find the commands in the bin directory through the Path environment variable to compile and execute our program correctly.
This article is from the "cainiao have e ambition" blog, please be sure to keep this source http://surong.blog.51cto.com/6118270/1293974