Installation of jdk before installing ElasticSearch

One.windows

  1. Download jdk software

(1).Enter jdk1.8 official website

(2). Download on demand according to whether the computer is 32-bit or 64-bit

(3). After clicking download, it will jump to the Oracle account login interface

If you don’t have an Oracle account , just register

The downloaded jdk is as follows:

  1. Double-click the next step to install jdk in the next step. The default installation is fine.

  1. Configure environment variables

(1). Setting options at the bottom left of the computer

(2).Select system

(3). About -> Advanced System Settings

(4). Select 'Environment Variables'

(5). Click System Variables → Click New

(5). JAVA_HOME is added in the system variable, and the setting value is the java sdk root directory

(6). Find the Path in the system variable and add the following code in the Path environment variable

%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin
Note: All are operated in system variables

(7). Verify that jdk is configured successfully

Enter javac, java, or jave -version in the console, and the corresponding code can be displayed to indicate success.

Two.linux

  1. Check if the Java version meets the requirements on Linux

 java -version
If you run the above command and report an error: -bash: java: command not found , first check whether there is jdk, if there is an installation package, go to step 6 directly , if not, download jdk and install it
  1. Download the jdk package

Java downloads
  1. Create a Java installation directory under the usr directory

cd /usr
mkdir java
  1. Copy jdk-xxx-linux-x64.tar.gz to the Java directory

cp jdk-xxx-linux-x64.tar.gz /usr/java/
  1. decompress jdk

tar -zxvf  jdk-xxx-linux-x64.tar.gz
  1. Edit the configuration file and configure environment variables

vim /etc/profile

Add at the end of the file

export JAVA_HOME=/usr/java/jdkxx_xx
export CLASSPATH=$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
  1. Reboot the machine or execute the command

source /etc/profile 或 sudo shutdown -r now
  1. Check the installation

[root@zph jdk]java -version
jave version "20.01.22"
Java(TM) SE Runtime Enviromet (build 20.01.00_11-b21)
Java HotSpot(TM) 64-bit Server Vm (build 25.11-b04, mixed mode)

Guess you like

Origin blog.csdn.net/zhoupenghui168/article/details/130789485