JDK installation and environment variable configuration detailed tutorial

JDK installation and environment variable configuration detailed tutorial

JDK is a necessary development kit for developing java programs. If you want to develop java programs, you need to install jdk. Let me share with you the detailed process of jdk installation and environment variable configuration.


download jdk

First go to download the jdk installation package. Click here or copy the address:
https://www.oracle.com/java/technologies/javase-downloads.html

to open the browser to open the Oracle official website (because Oracle acquired the sun company, you can download jdk directly on the Oracle official website ). It can be seen that as of now (2021-5-1), JDK has been updated to JDK16. Harm, complain about this update speed. However, at present, JDK8 is still the mainstay in the enterprise, so I also install the jdk8 version.
as the picture shows:
insert image description here


Swipe down the page to find jdk8, just download jdk8, click JDK Download
as shown in the figure:
insert image description here
enter the following interface:
insert image description here
pull down to find the version corresponding to your operating system . My computer is a windows 10 64-bit operating system, so I choose the version of windows x64, friends can choose the corresponding version according to their own operating system, and then click to download.
As shown in the picture:
insert image description here
Then agree to this constraint, and then click download (you can’t download if you don’t agree).
As shown in the picture:
insert image description here
Friends who click download may let you log in. If you have an Oracle account, log in. You can also register one of them, just fill in some simple information, and then a download prompt box will pop up, choose a path, and click download. If you don't want to register, I provided the download link of Baidu Netdisk at the end of the article, and you can use Baidu Netdisk to download.
insert image description here


install jdk

After the download is complete, we get an .exe execution file, just double-click the execution file.
As shown in the figure:
insert image description here
Don’t worry about this, just go to the next step:
insert image description here
Here, friends need to pay attention, there is a path here, you can change it if necessary , but it is not recommended to have Chinese or spaces in the path. After selecting it, just go to the next step:
insert image description here
executing the installation...
insert image description here
At this point, jdk has been installed, but an independent jre will pop up. It is recommended that all friends install this independent jre, because some development Tools, such as eclipse, will detect this jre, and if not, an error may be reported. I installed this independent jre here.
insert image description here
Here too, try not to appear Chinese and spaces in the path. After selecting the path, just go to the next step and wait for the installation.
insert image description here
The installation process will not last for a long time, and it will be completed soon. After completion, this interface will appear. Click Finish to complete the installation of jdk and independent jre. The following is the configuration of environment variables
insert image description here


Configure environment variables

First of all, right-click the computer, click Properties:
insert image description here
click Advanced System Settings:
insert image description here
click Environment Variables:
insert image description here
Here you need to pay attention to friends, there are two places to configure environment variables in this place, the environment variables configured above are only valid for the current user, and the following ones It is valid for all users, and I will configure it under the system environment variable. Click New
insert image description here
to pop up this window, enter the variable name: JAVA_HOME, note that it is all uppercase, this is not only a convention, but also paves the way for us to install tomcat later. Because tomcat wants to search the directory of "JAVA_HOME". (Anyway, this is the right thing to do.) Click Browse Directory, select your own jdk installation directory, and go to the root directory. Here, friends should choose according to their own installation path, and then click OK.
insert image description here
The JAVA_HOME variable is now set:
insert image description here
now we need to configure the Path environment variable. Find the Path environment variable in the environment variable, if not, just create a new one, the problem is not big. As shown in the figure: After selecting the Paht variable, click Edit (this step is a little different if it is windows7).
insert image description here

When this interface appears, we click New:
insert image description here
enter the variable value in the input box: %JAVA_HOME%\bin, and then click OK
insert image description here
. In order to ensure nothing goes wrong, here we suggest that you move the newly created variable value up to the top (because it may be on the computer) The same executable file exists in other paths, and then it cannot be executed correctly when searching), click OK, and the environment variable configuration is complete!
(Some friends may see that the classpath environment variable needs to be configured in other places, but it is actually not necessary. It is useless to configure it, and it can be configured without configuration) as shown in the figure
:
insert image description here

Verify correct installation and configuration

Now let's verify that the environment variables are configured successfully. Press the shortcut key: win+r to open and run, enter the cmd command, and then press Enter:
insert image description here
after opening the command line window, enter javacand then press Enter:
insert image description here
continue to enter java:
insert image description here
input java -version:
insert image description here
If the previous three steps are output normally, then it proves that we have installed jdk and configured The environment variable did the trick!


jdk Baidu network disk download link: https://pan.baidu.com/s/10okBC5PJaAcT0wZUyB7mhw
Extraction code: j3nx

Guess you like

Origin blog.csdn.net/daiyi666/article/details/116333121