2020.11 latest JAVA environment installation and configuration

Insert picture description here

Source: WeChat Official Account "Programming Learning Base"

Java environment configuration under Windows 10

Update: November 25, 2020

Computer environment:

windows10 64 bit

One, download jdk

First go to the Oracle website to download the jdk installation package corresponding to the operating system.

https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

Insert picture description here

You can also use the installation package I provided (download date is 2020.11.25 Java SE Development Kit 8 latest version)

Link: https://pan.baidu.com/s/1tL6_u5VDJu7yq2u49NUleg
Extraction code: 97q4

Two, install jdk

  1. After the download is complete, click Open all the way and click "Next" to install, the jdk will be installed automatically during the installation process

  2. Another window will pop up midway to let you choose the jre installation location, click "Next" to install jre automatically.

That is, the jre installation location is:

C:\Program Files\Java\jdk1.8.0_271

That is, you can open this folder in the folder, which has jre related configuration

  1. After the installation is complete, you need to configure environment variables

Three, configure environment variables

If you are using the JDK provided by me, and it is installed by default all the way next, then congratulations on your environment variable configuration directly copy and paste mine

Right-click " This Computer " on the desktop , left-click " Properties ", find and click " Advanced System Settings " on the left side of the pop-up window .

Insert picture description here

Find " Environment Variables " at the bottom right of the pop-up window and click

Insert picture description here

Set the variable name as follows:

variable name:CLASSPATH

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

Insert picture description here

variable name:JAVA_HOME

variable:C:\Program Files\Java\jdk1.8.0_271

Insert picture description here

variable name:Path

variable:%JAVA_HOME%\bin

variable:%JAVA_HOME%\jre\bin

Insert picture description here

The premise of using my environment variables is the default installation, that is, the jre installation location is:

C:\Program Files\Java\jdk1.8.0_271

That is, you can open this folder in the folder, which has jre related configuration

Fourth, verify that the java environment is installed successfully

  1. Press and hold " windows+r" to open the "Run" dialog box, enter cmd, and click "OK" to open the command line.
  2. Enter " java"," javac", " java --version" in order on the command line

No error or no prompt

" javac,java" Is not an internal or external command, an executable program or a batch event

Five, run hello world

  1. Create a new "test" folder in the root directory of Disk D, create a new txt file in the "test" folder, and rename it to "test.java".
  2. Open "test1.java" with Notepad or NotePad++ and enter the following code
public class test {
    
    
    public static void main(String[] args) {
    
    
        System.out.print("Hello World!");
    }
}
  1. Press and hold "ctrl + r" to open the "Run" dialog box, enter cmd, and click "OK" to open the command line.
  2. Enter " D:"
  3. Enter " cd test" to enter the "test" folder.
  4. Enter " javac test.java" to compile the "test1.java" file into a class file.
  5. Enter " java test" to run the newly compiled class file, and you can see the printed "Hello World!"
Microsoft Windows [版本 10.0.18363.1198]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\DeRoy>D:

D:\>cd test

D:\test>javac test.java

D:\test>java test
Hello World!
D:\test>

Guess you like

Origin blog.csdn.net/qq_44519484/article/details/110123211