1.windows install jdk
Webcast abound, not repeat them, refer to Baidu experience
2.linux install jdk
2.1. Check whether the system is installed java
[root@localhost home]# yum list installed | grep java
2.2. If you have an older version of java, you can use the following methods to uninstall java
[root@localhost home]# yum -y remove java-1.8.0-openjdk*
2.3. View a list of java package
[root@localhost home]# yum -y list java*
2.4. Java1.8 download and install all the packages, the way you need to enter y to confirm the download.
[root@localhost home]# yum installjava-1.8.0-openjdk*
2.5. Installed successfully, enter the following command to check whether the installation was successful, it returns the correct version number if the installation was successful.
[root@localhost home]# java -version
2.6. The environment variable configuration
2.6.1 modify / etc / profile file, add JAVA_HOME
vi /etc/profile
#set java environment
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin
:wq
. /etc/profile //使配置生效
2.7 verification
[root@localhost home]# java -version
[root@localhost alternatives]# echo $JAVA_HOME
3.docker install jdk
1 Find jdk Mirror:
$ docker search jdk
Openjdk Mirror 2 Download:
$ docker pull openjdk
3 runs jdk container:
$ docker run -d -it --name myopenjdk openjdk /bin/bash
4 into the container verification:
$ docker exec -it myopenjdk /bin/bash