JDK installation and environment variable deployment

Before installing JDK, you must first clearly know the difference between JDK and JRE:

  • JDK is an SDK (Software Development Kit commonly known as Software Development Kit) for developers.
  • JRE (Java Runtime Enviroment) refers to the operating environment of Java, which is geared towards the use of java programs.

table of Contents

table of Contents

JDK download

JDK environment variable configuration

Windows environment JDK environment variable configuration

Linux environment JDK environment variable configuration

Verify JDK installation and configuration

JDK verification configuration in Windows environment

Linux environment JDK verification configuration


JDK download

 1. JDK download address: click to download the official website address directly

Choose different versions of JDK according to your needs

Click the Download button to enter the download, you will see the following picture

When downloading, you need to select the applicable operating system and number of bits.

Usually 32-bit systems only support 32-bit JDK, and 64-bit systems support both 64-bit and 32-bit JDK.

How to check the number of digits on your computer

Windows users directly: "My Computer"-right click-"Properties"

Linux users: execute the command uname -m

After downloading, the installation location defaults, all the way to the next step, until the installation is completed-"Close".

JDK environment variable configuration

Windows environment JDK environment variable configuration

"My Computer"-right click-"Properties"-(left side) advanced system settings-(bottom right corner of the pop-up window) environment variable configuration

The upper part of the window is the user variable, and the lower part is the system variable. In the future, all your variables will be configured in the system variable !

1 创建JAVA_HOME,值是你的刚刚jdk的安装目录,比如     C:\Program Files (x86)\Java\jdk1.8.0_101
2 创建CLASSPATH,值是  .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar(注意最前面有一点)
3 编辑Path,把值放到最前边  %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;

You must remember in the process of adding variables in the future. Every time you add something, there must be a semicolon ";". Pay attention to check whether the letters and semicolons are added correctly.

Linux environment JDK environment variable configuration

Modify the /etc/profile file

·Open /etc/profile with a text editor

Add at the end of the profile file:

export JAVA_HOME=/usr/share/jdk1.8.0_101
export PATH=$JAVA_HOME/bin:$PATH 
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

Verify JDK installation and configuration

JDK verification configuration in Windows environment

Run CMD (Win+R or click the input of the start menu in the lower right corner), and enter the two commands in the red box in the expanded command line window to verify!

Linux environment JDK verification configuration

Guess you like

Origin blog.csdn.net/baidu_31572291/article/details/101282864