Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to install the latest version of jdk and environment variables

Shulou Source: shulou.com Published: 2022-06-02 02:13:04 10月19日 Update

This article is to share with you about how to install the latest version of jdk and the environmental variables, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

download

JDK

Java's official website is called www.sun.com.

Installation

Double-click the file jdk-8u144-windows-x64.exe and follow the wizard step by step. (note that the installation directory should be appropriate)

Modify the installation path

After the JDK installation is completed, an interface will pop up to install JRE, just click close.

Environment variable

A configuration environment variable is a set of paths

Start a dos; and tap a command in dos, and the system will find it according to one of the paths configured in the environment variable, the command .exe, the command .bat, the command .cmd. If it is found, it will be executed. If it cannot be found, the following command will be reported that the external command cannot be executed.

Open dos (command prompt)

Press the windows key (the key in ctrl and alt with Windows's logo on one side) + R, and an interface pops up:

Click the start menu

Dos enhanced version

Enter command: in the newly opened dos window, type: notepad to open a notepad

Default environment variables:

% SystemRoot%\ system32;%SystemRoot%;%SystemRoot%\ System32\ Wbem;%SYSTEMROOT%\ System32\ WindowsPowerShell\ v1.0\; C:\ java\ TortoiseGit\ bin;C:\ java\ TortoiseSVN\ bin;C:\ java\ Git\ cmd

Where:% SystemRoot% refers to c:\ windows, and the input notepad.exe finds the notepad.exe at: C:\ Windows\ System32, so it executes. To use before multiple paths; separate.

Configure environment variables

When you enter javac, the following interface appears by default, indicating that the system cannot find javac.exe,javac.bat,javac.cmd in a large number of paths specified in the environment variable (path), so the following error will be reported

Actually javac: it's under C:\ Java\ jdk1.8.0_144\ bin

If you do not configure the environment variable, you must write down the path every time you access the javac. If you follow the given path, if you can't find it, go to the environment variable.

Absolute path: (reference: root directory)

C:\ Java\ jdk1.8.0_172\ bin\ javac.exe

Relative path: (reference: current directory)

Bin\ javac.exe

Examples

Relative path:

Village: just say the group when you introduce it; reference: village

Town: let's first talk about the XX group of XX village; reference: town

Beijing web page: X province, city, X county; reference: Beijing

Absolute path:

At any time: say X province, city, X county; frame of reference

Nothing is forever absolute; it's just that the frame of reference is different.

Tips for using Dos:

First name

Description

Examples

Toggle drive letter:

Drive letter + colon

C:

Go to a directory

Cd + path

Cd c:\ Java\ jdk1.8.0_172\ bin\ javac.exe

Current path

.

Upper-level path

..

This path is not configured in the default environment variables:

Default environment variabl

% SystemRoot%\ system32;%SystemRoot%;%SystemRoot%\ System32\ Wbem;%SYSTEMROOT%\ System32\ WindowsPowerShell\ v1.0\; C:\ java\ TortoiseGit\ bin;C:\ java\ TortoiseSVN\ bin;C:\ java\ Git\ cmd

Solution

Create a variable value: JAVA_HOME, which is the installation path of jdk

Configure PATH environment variables

% JAVA_HOME%\ bin;%SystemRoot%\ system32;%SystemRoot%;%SystemRoot%\ System32\ Wbem;%SYSTEMROOT%\ System32\ WindowsPowerShell\ v1.0\; C:\ java\ TortoiseGit\ bin;C:\ java\ TortoiseSVN\ bin;C:\ java\ Git\ cmd

Click OK all the way

After configuring the environment variables, you need to reopen a new dos

The above is how to install the latest version of jdk and the environment variables. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Path variable environment command reference configuration time input that is interface directory version example more province and city knowledge article system Beijing appropriate Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MariaDB Linux Apple Xiaomi