[Gorgeous transformation of the zero-based Xiaobai] Create the environment of the Dynamic Web Project project --- JDK download and installation (with case)

Due to the length of the space, the topic of creating a project is divided into three parts, and interview questions will be added at the end of each article. Make a little progress every day, and an annual salary of one million is just around the corner! ! !Insert picture description here

 
 

[catalog]

1. JDK (on)
  1. JDK download and installation
  2. JDK environment variable configuration
  3. Interesting PATH environment variable practical small application
  4. [Daily side] The relationship between JDK and JRE and JVM

2. Tomcat (middle)
  1. Tomcat download and installation
  2. Tomcat environment variable configuration
  3. Actual small applications
  4. [Daily side]

2. Maven (below)
  1. Maven download and installation
  2. Maven environment variable configuration
  3. Practical small applications
  4. [Daily side]
 
 

1. JDK download and installation

JDK (Java Development Kit) is a software development kit of Java language, mainly used for java applications on mobile devices and embedded devices. JDK is the core of the entire java development, it contains the JAVA operating environment (JVM+Java system class library) and JAVA tools . For example: javac.exe, java.exe, jar.exe, etc.

点击进入Oracle官网下载
You need to register for an Oracle account, fill in the information, and download it after logging in. Now the latest version is JDK15. I downloaded JDK8. You can see it by scrolling down.

Insert picture description here
After the download is complete, find the installation package and start the installation program.
Insert picture description here
Click Next.
Insert picture description here
Click Next. The installation path can be changed. It can be any folder without spaces on any disk. I will not change it and use the default path. After the change, another path will be changed later, which is troublesome.
Insert picture description here
Wait a moment
Insert picture description here
for the installation to complete.
Insert picture description here
Click Next.
Insert picture description here
Finally, wait for the installation to complete.
Insert picture description here
Then you can see that there are already files we just installed in the installation path (I have installed it before, and I installed it again in order to write the tutorial, so there are multiple versions). If you are careful, you will find that there are more folders Out of the jre folder which is the same as the jdk version, this is explained in the definition, jdk contains jre and java tools. If you just run the project, you can install jre, but if you want to program, you must install jdk.

Insert picture description here

2. Configuration of JDK environment variables

The purpose of configuring environment variables is to facilitate compiling and running java programs on the console, without having to enter the java program directory (installation directory) to run. In this way, the java program files you put in any directory (such as the desktop) can be compiled and run, instead of having to put this program file in the directory where java.exe and javac.exe are located. This will be much more convenient !
When executing the java.exe command, the console will first find the java.exe program in the current directory, so if your java program file happens to be in the directory where java.exe is located, it can run successfully, if not, then the console Just go to the path specified in the path variable to find it. So it will be much more convenient after configuration! You can compile and run the java program files in other directories through the console!

windows+ EEnter [My Computer] → right-click and select [Computer Properties] → Control Panel and click [Advanced System Settings] → switch to the [Advanced] tab → click [Environment Variables] to configure

  1. JAVA_HOME environment variable It points to the jdk installation directory , and software such as Eclipse/NetBeans/Tomcat finds and uses the installed jdk by searching for the JAVA_HOME variable.
C:\Program Files\Java\jdk1.8.0_271 -- 粘贴在【JAVA_HOME】,没有就自己创建一个JAVA_HOME变量
  1. The role of the PATH environment variable is to specify the command search path. When executing a command under the shell, it will look in the path specified by the PATH variable to see if it can find the corresponding command program. We need to add the bin directory under the jdk installation directory to the existing PATH variable. The bin directory contains frequently used executable files such as javac/java/javadoc, etc. After setting the PATH variable, you can Tools such as javac/java are executed under the directory. This can be obtained, as are other procedures .
 ;%JAVA_HOME%\bin -- 粘贴在【PATH】变量尾部
  1. The role of the CLASSPATH environment variable is to specify the class search path. To use the compiled classes, the premise is of course that they can be found. JVM searches for classes through CLASSPTH. We need to set dt.jar and tools.jar in the lib subdirectory of the jdk installation directory to the CLASSPATH, and the current directory "." must also be added to the variable.
.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\tools.jar -- 粘贴在【CLASSPATH】变量尾部
!!!注意前面有一个点也要一起粘进去!!!
  1. Check whether the configuration is successful
    windows+ Ropen [Run] → enter cmd to enter the [command prompt window] → enter [javac -version]

Insert picture description here
*** If the java version does not appear, the environment variables are not configured properly and need to be reconfigured.
 
 

~~~ Interesting practical small application of PATH environment variable~~~

 
 
Find the directory where the executable program of Meitu Xiuxiu is located

Insert picture description here
Copy the address bar and paste the path into the Path environment variable

Insert picture description here
windows+ ROpen [Run] → enter cmd to enter the [command prompt window] → enter [xiuxiu] →Enter

Insert picture description here
Press the Enter key and you will be surprised to find that Meitu Xiuxiu software is opened!
windows+ ROpen [Run] → enter [xiuxiu] → Enteryou can also open Meitu Xiuxiu

Insert picture description here
 
 

【Daily Side】

The relationship between JDK and JRE and JVM

JDK (Java Development Kit) : Java development kit. jdk is the core of the entire Java development, it integrates jre and some useful gadgets . For example: javac.exe, java.exe, jar.exe, etc.
JRE (Java Runtime Environment) : Java runtime environment. It mainly contains two parts, the standard implementation of jvm and some basic Java libraries. Compared with jvm, it is part of the Java class library .
JVM (Java Virtual Machine) : It is the Java virtual machine we are familiar with. It only recognizes xxx.class files, it can recognize the bytecode instructions in the class file and call the API on the operating system to complete the action. Therefore, jvm is the core of Java's cross-platform , and the same piece of code has the same bytecode after compilation. At the Java API level, the code that we call the system sound device is unique, independent of the system, and the bytecode generated by the compilation is also unique. However, the same piece of bytecode will be mapped to the API calls of different systems on different JVM implementations, so that the code can run across platforms without modification.
Obviously, the relationship between these three is: a layered nesting relationship. JDK>JRE>JVM .

Guess you like

Origin blog.csdn.net/weixin_44598507/article/details/109382091