[JAVA] JDK 1.8 environment deployment under Windos and Linux

JDK1.8 deployment under Windos:

installation

Go to Oracle's official website and download the JDK.

JDK is called JAVA Development Kit, SE EE ME and so on.

SE is used here.

Download and install path

The first installation path is JDK 

The second installation path is JRE

Be sure to distinguish between these two . You can't choose the wrong one when using the environment variable configuration later! It is recommended to simplify the installation path for future learning. For example F: \ xx

Environment variable configuration

Right click this computer under Win10-Advanced System Settings-Advanced-Environment Variables

Get there

 Create a new variable in the system variable, the variable name is JAVA_HOME. This is convenient for the system to find and reduce the repeated use of absolute paths

Mine is F: \ JAVA ( The JAVA path here is the path of the JDK and not the path of the JRE has been emphasized earlier)

 Then find the path in the system variable, which is the environment variable.

Create two new ones (be careful not to delete others, which may affect the operation of the system) 

%JAVA_HOME%\bin;

%JAVA_HOME%\jre\bin;

Remember to be sure

 This configures the environment variables

Win + R enters the run interface, enter cmd run command dos window,

Check if the environment variable is set

Enter set path in the dos interface

See if there are environment variables just configured

If there is, it succeeds!

JDK environment deployment under Linux

First download the JDK Linux version on Oracle's official website

Here I use Centos 7 operating system with Gnome graphical interface

Download and unzip to a folder

Remember the version name, for example mine is jdk1.8.0_181

I named it java

Then start to configure environment variables

Install vim (my own Baidu)

Enter vim / etc / profile on the command line (modify environment variables)

Add at the end

JAVA_HOME= / java /jdk1.8.0_181

CLASSPATH=.:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH

 

export JAVA_HOME CLASSPATH PATH

 

Then save and exit: wq 

At last

source / etc / profile makes environment variables take effect

Last test is successful

java -version 

The version number is correct

 

Written a long time ago. . .

 

Published 22 original articles · Likes2 · Visits 881

Guess you like

Origin blog.csdn.net/weixin_41685373/article/details/82589718