Teach you how to build a Java environment

Author: Han Ru

Company: Procedural Coffee (Beijing) Technology Co., LTD

Procedure: IT professional skills evaluation platform

Website: www.chengxuka.com

task

1. Download JDK 2. Install JDK 3. uninstallCopy the code

To learn and develop the Java language, we must first build the Java development environment. Just like when we cook a braised prawn, we have to have a kitchen first. Only in the kitchen can we use the gas stove, oil, salt and so on to make a dish. Similarly, we can only write and run Java programs if we have a Java development environment installed.

Download JDK

Java has been acquired by Oracle.

www.oracle.com/cn/index.ht…

  • 1, first, open a browser, enter the above Oracle official website url

  • 2, then click on products, open the list of products, click Java

  • 3. Click Download Java to enter the Java Download page

  • 4. Scroll below to find the Java8 version. Although the latest version is Java14, we strongly recommend choosing Java8.

  • 5, according to their own computer operating system, download.

Of course, you can also get it through the following web disk link

Pre-class kit: link :pan.baidu.com/s/1Kqg-O0r7… Password: dqh4

Install JDK

The installation of the JDK is a mindless installation, which is the next step along the way. Until it’s done. By default, it is installed in the Program Files directory under the C drive. However, if you want to change the installation directory, follow these steps carefully.

If you do not want to install the JRE in the default directory, do not overwrite the JDK when installing it.

1, find the downloaded JDK installation package, double-click to install

Install JDK first. During the installation process, it will be installed in the Program Files directory of disk C by default. If you want to change the installation directory, you can click the change button. Of course, you can also install it in the default directory.

3, directly manually modify the installation directory, change the C drive to the drive letter you want to install.

4. After modifying the JDK installation path, click Next.

The next step is to install the JDK and then to install the JRE. If you do not want to install to the default C drive, click the Change button. It is generally recommended that you install the JRE and JDK in the same directory.

6, here will pop up the browse box, we click D disk, then click Java. The JRE installation requires us to manually create an installation folder ourselves.

7. The name of the folder to install the JRE, we manually enter: JRE followed by the version number. Jre1.8.0 _77.

8, click OK, you can continue to install.

9. The JDK and JRE are installed.

10, then check the installation directory, open disk D, Program Files directory, more than a Java folder, click in after two folders, one is the JDK installation directory, one is the JRE installation directory.

Many new students do not pay attention to the installation directory when installing jre. When installing JRE, they will accidentally overwrite the JDK that has just been installed. So be careful.

11. Open the JDK folder

  • Bin directory: the executable file of the JDK development tool. Commands such as javac.exe and java.exe are in this directory.
  • Db: Includes Java DB, which is a SQL relational database management system based on the Java programming language.
  • Include: Includes C header files and supports native programming techniques such as Java Native interface and Java Virtual Machine debugger interface.
  • Jre: indicates the root directory of the Java runtime environment, which contains the Java virtual machine, runtime class package, and Java application initiator. It does not include development tools in the development environment.
  • Lib directory: archive package files used by development tools.
  • Src. zip: Java source code package
  • .

3. Configure environment variables

Right-click on this computer and select Properties, then click Advanced System Settings to open the System Properties window.

Then click Advanced and click environment variables below to open the environment variable Settings window.

1. In system Variables, click New and configure the JAVA_HOME variable. The variable value is where the JDK was just installed.

2. Configure the CLASSPATH path:

3, modify path:

On our Windows system, the path variable is built-in, and we need to configure the BIN directory in the JDK to path. So I’m going to edit here:

Then create the bin directory in the JDK and the bin directory in the JRE.

My Computer --> Page margin, right mouse button --> Properties --> Left sidebar Advanced System Settings --> Environment Variables New: JAVA_HOME :D:\Program Files\Java\jdk1.8.0_77 %JAVA_HOME%\lib; %JAVA_HOME%\lib\tools.jar %JAVA_HOME%\bin; %JAVA_HOME%\jre\bin;Copy the code

4. Click OK after the configuration. The configuration will take effect.

Step pit 1: After setting environment variables, click the “confirm” button for the configuration to take effect.

Step pit 2: Restart the DOS black window after environment variables are configured

4. Test whether the installation is successful

Open the terminal:

Method one: start | | command prompt Windows system

Method 2: Search the command prompt or CMD in the search box

Method 3: Shortcut key: Win +R, and then enter CMD

Note: If you opened the DOS window before configuring environment variables, you will need to reopen the DOS window after configuring environment variables.

Test 1:

Test 2:

Five, the unloading

If the installation is in the wrong directory, or if you want to change the installation path, you may want to uninstall the JDK and reinstall it. Do not cut the installation package directly.

If you have 360 or Tencent Butler software, you can use them to uninstall JDK. Otherwise, perform the following operations to uninstall it:

1. Open the control panel, click the Application, and select Uninstall:

Java SE Development Kit 8 Update Java SE Development Kit 8 Update

3, then check the installation directory below. Normally, this directory will be removed when you uninstall the JDK, but if it is not, you can manually remove it and then reinstall the JDK.