'keytool' is not recognized as an internal or external command, operable program or batch file

1. Check whether JDK is configured in the computer configuration environment

"keytool" is not an internal or external command, nor is it an executable program or batch file. When this error occurs, it is generally a problem with the computer's Java jdk environment configuration. You can run java and javac through the command line to check whether the environment is configured. good

2. Download and install JDK (including installation files)

2.1 Download
Download JDK from the official website: https://www.oracle.com/cn/java/technologies/downloads/#jdk19-windows
Windows X64-based JDK8, JDK17 network disk link download of installation files:
link: https://pan .baidu.com/s/1qWoww4sY_mw0ejsEFn5ptw?pwd=s89g Extraction code: s89g
2.2 Note

  • For different operating systems (windows, macOS, Linux, etc.), you need to download the corresponding version of JDK.
  • ​If the computer is Windows 32-bit, it is recommended to reinstall the system to a 64-bit operating system .
  • Java has not provided a 32-bit version of the installation package since version 9 .

insert image description here

3. Install

3.1 Installation process
Double-click the installation file to enter the JDK installation window, click Next,
insert image description here
click Next again
insert image description here
, and click Close to complete the installation.
insert image description here
The default installation path is under C:\Program Files\Java, and you can also customize the installation path

suggestion:

  • The installation path should not contain Chinese characters, spaces or other special symbols.
  • In the future, all software suggestions related to development will be installed in the same folder for easy management.

4. Environment configuration

4.1 Why configure environment variables
To develop Java programs, you need to use the development tools provided by JDK (such as javac.exe, java.exe and other commands), and these tools are in the bin directory of the JDK installation directory. If you do not configure environment variables, then These commands can only be used in the bin directory, and we want to use them in any directory, so we need to configure environment variables.

Note: Now the latest JDK downloaded from the official website will automatically configure the paths of javac and java commands to the Path environment variable during installation, so javac and java can be used directly.

4.2 Configuration method
insert image description here
The old version of JDK downloaded before is not automatically configured, and the automatically configured one only contains 4 tools, so we need to delete the configured ones and reconfigure the Path environment variable again.

1. JAVA_HOME : Tell the operating system where the JDK is installed (in the future, other technologies will use this to find the JDK), and the attribute value is the installation directory of the JDK .

As shown in the figure below, the installation directory of JDK8 is still: C:\1Applications\Java\jdk1.8.0_261
Therefore, the attribute value of JAVA_HOME is C:\1Applications\Java\jdk1.8.0_261
insert image description here
**2.Path:** Tell the operation Where
insert image description here
are the javac (compilation) and java (execution) commands provided by the system JDK installed
? Indicates that the operating system does not support custom environment variables. (rarely this problem occurs)

step:

Still need to configure JAVA_HOME for future related software to use

We can configure the full path of java and javac to PATH.

4.4 Installation verification
Enter the command in cmd: java -version
to view the corresponding installation version information.
insert image description here

Guess you like

Origin blog.csdn.net/qq_41842461/article/details/129021597