The process of JDK installation and configuration of environment variables under WIN10 (detailed version)

The process of JDK installation and configuration of environment variables under WIN10 (detailed version)

If you want to learn JAVA, you must install JDK (Java Development Kit) and configure the environment variables before you can learn Java. After several failed attempts to configure the environment variables, I finally succeeded. This blog post is formed by summarizing the problems encountered. Welcome to communicate. [Of course, I’m a newbie.] 】Common reasons for failure are as follows:

  • Installation problem: Installing jdk and jre in the same folder causes the "original files in jdk" to be overwritten. (A javac instruction error occurred.)
  • Variable confusion: After opening the environment variable setting box, there are two categories: "user variables" and "system variables". We need to configure system variables.
  • Path error: The variable value of JAVA_HOME variable is the file path of the "jdk" we installed. (Direct copy and paste is recommended.)
  • Statement error: The variable value of CLASSPATH is wrong, there must be a dot "." at the beginning! ! ! (Direct copy and paste, see below.)
  • Path error: The variable value in Path under win10 only recognizes the absolute path and cannot be referenced as %java_home%.

1. Download JDK (take jdk1.8.0 as an example)

You can download it directly from CSDN. I have personally tested the following resources and found them to be effective.
JDK1.8.0 Download

Once the download is complete, it should look like this.

After the download is complete, it will be an installation program.

2. Install JDK (do not use next without thinking)

When the installation program is in progress, first install the jdk (default path: C:\Program Files(x86)\Java\jdk1.8.0-60\) and then install the jre (default path: C:\Program Files(x86)\Java\jre1.8.0-60\). We don’t like to install so many software on the C drive. When we customize the installation, if they are all installed in one folder, the later installed jre will overwrite the original files. That is to say, jre must be installed in another folder.

Check method: Open the directory where JDK is installed, search for javac.exe in the bin folder, if it is not there, it has been overwritten. When I check the installation at the end, both java -version and java commands can be executed, but javac command will show: javac shows "not an internal or external command.
Click the installer to run it directly. [Go directly to the picture]

JDK installation
Custom
jre installation

My suggestion is: before installation, create a java folder in the target disk, and create two folders, jdk and jre, under this folder, and install them respectively.

insert image description here

At this point, JDK has been installed correctly.

3. Configure JDK environment variables

Right-click This PC, click Properties, and then click Advanced system settings.

insert image description here

Create a new system variable JAVA_HOME (write directly)

insert image description here

Create a new system variable CLASSPATH (write directly)

insert image description here

Variable value: (Don't lose the first one!!!) (Strictly copy)

.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

Adding a dot means that you can run Java in any directory.

Edit the system variable Path (add two values)

insert image description here

Many installation tutorials write %java_home% here, but the Path under the win10 system does not support %java_home%, which represents the value of the java_home environment variable and is a reference. But the absolute path must be used here in win10.

At this point, you have completed the configuration of environment variables. Normally, you have succeeded. Let's check it below.

4. Check whether the environment variables are correct

Press WIN+R, enter cmd, enter the command line interface, and perform three checks.

java -version check

enter:

java -version

insert image description here

2. Java inspection

java

insert image description here

3. Javac check

javac

At this point, you have completed the JDK installation!

insert image description here

If other errors are found, you can check whether the Chinese and English formats, uppercase and lowercase letters, and paths are correct.

V. Other Notes

1. User variables and system variables

There are two locations for setting environment variables, one is user variables and the other is system variables. User variables are only useful to the user, and system variables are useful to the system. If there are two users on your computer, setting it in user variables is only useful for the current user, while setting it in system variables is useful for both users. Generally, it is set in the system variable location.

2.java and javac

javac: is a compilation command that compiles Java source files into .class bytecode files.
For example: javac hello.java will generate hello.class file.
Java: It runs bytecode files; the bytecode is interpreted and run by the Java virtual machine. For example: java hello
For details, please see: Use and precautions of javac and java in cmd

Summarize

This is the end of this article about the process of JDK installation and configuration of environment variables under WIN10 (detailed version). For more relevant content about configuring JDK environment variables under WIN10, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Win10 Java jdk14.0.2 installation and environment variable configuration detailed tutorial
  • win10 java (jdk installation) environment variable configuration and related issues
  • JDK13.0.1 installation and environment variable configuration tutorial with pictures and text (Win10 platform as an example)
  • Detailed tutorial on jdk installation and environment variable configuration under Win10

<<:  Solution to leaving gaps between BootStrap grids

>>:  Use Grafana+Prometheus to monitor MySQL service performance

Recommend

Docker deployment RabbitMQ container implementation process analysis

1. Pull the image First, execute the following co...

Solution to uninstalling Python and yum in CentOs system

Background of the accident: A few days ago, due t...

React+TypeScript project construction case explanation

React project building can be very simple, but if...

Manjaro installation CUDA implementation tutorial analysis

At the end of last year, I replaced the opensuse ...

Docker cleanup environment operation

Start cleaning carefully! List unused volumes doc...

Cross-browser development experience summary (I) HTML tags

Add a DOCTYPE to the page Since different browser...

js canvas realizes rounded corners picture

This article shares the specific code of js canva...

A brief discussion on the magical uses of CSS pseudo-elements and pseudo-classes

CSS plays a very important role in a web page. Wi...

Practical solution for Prometheus container deployment

environment Hostname IP address Serve Prometheus ...

Simple web design concept color matching

(I) Basic concepts of web page color matching (1) ...

CSS setting div background image implementation code

Adding background image control to a component re...

How to analyze MySQL query performance

Table of contents Slow query basics: optimizing d...

CentOS6.9+Mysql5.7.18 source code installation detailed tutorial

CentOS6.9+Mysql5.7.18 source code installation, t...