Installation of jdk in windows and linux environment

Installation of jdk in windows and linux environment

The download address of jdk
is https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
. After downloading the jdk installation package of the corresponding system, install it.
JDK has different installation methods for different systems. , what I bring to you today is the installation of JDK in windows and linux environments.

under windows environment

Select the jdk installation directory
insert image description here

Select the installation directory of jre. You can also skip this operation and directly use the default jre.
insert image description hereAfter installation, enter the configuration of environment variables .

Environment variable settings

This computer——》Properties——》Advanced system settings:
insert image description hereCreate the JAVA_HOME directory in the system variable. The value of the directory is the jdk installation directory. My installation directory here is D:\InstallProgram\jdk. The installation directory of jdk is specified here. Yes, there is no need to specify
insert image description herethe Path Path configuration in the bin directory of the installation directory
: "%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;"
Note: If the Path editing interface is like this, write two points
insert image description here

CLASSPATH: ".%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\dt.jar"
Note: If this directory does not exist, you must create it yourself

Finally, enter on the command line:
javac or java -version to check whether jdk is installed. If there is no display that the command cannot be found, it means that jdk has been installed successfully.

Under linux environment

There are two installation methods in the Linux environment . The yum installation method is similar to the installation package installation method in the Windows environment.
However, the jdk installed in the two methods is different. Yum installs OpenJDK. This kind of jdk is used for commercial development. OracleJDK does not include Deployment (deployment) function compared to OpenJDK: Deployment functions include: Browser Plugin, Java Web Start, and Java Control Panel. These functions cannot be found in OpenJDK, and the protocols used by the two are different. OpenJDK It is released under the GPL V2 protocol, while SUN JDK is released under the JRL. Although both protocols are open source, the difference in usage is that GPL V2 allows commercial use, while JRL only allows personal research use. To put it bluntly, OpenJDK is a streamlined version of jdk, so openJDK is better than oracleJDK. There are few functions. In order to make up for the shortcomings of openJDK, the missing functions of openJDK are made into plugins. Note that the jdk download address at the top of the article downloads OracleJDK. The biggest difference in installation is that OpenJDK does not need to configure environment variables.

-yum install

This command can view the installable jdk version
yum -y list java *
The installable jdk version shown here is
insert image description herethe command to choose to install OpenJDK (the one installed here is: java-1.8.0-openjdk-devel.x86_64)
yum install -y java-1.8.0-openjdk-devel.x86_64
Wait for the installation to complete.

After the installation is complete, check the installed jdk version and enter the following command:
java -version

Here you can see the jdk version information you installed.
If you are curious about where the jdk is installed in this automatic installation, you can actually find them under usr/lib/jvm.
OK, done!

Installation package installation

1. Click the link above to download the jdk version that needs to be installed. I am using jdk-8u181-linux-x64.tar.gz here.
2. Place the compressed package in the /usr/local/jdk directory. The jdk directory needs to be installed by itself. Create it manually, or call it java. You can choose the name yourself (see the name to know the meaning), then decompress the compressed package and enter the following command:
tar zxvf jdk-8u181-linux-x64.tar.gz
3. Next, it is time to configure the environment. variable, enter the following command to configure:
Because this method is similar to the method in the windows environment, but the commands used are different, I did not add the picture here
vim /etc/profile
export JAVA_HOME=/usr/local/jdk/ jdk1.8.0_181
export CLASSPATH= $ : CLASSPATH: $ JAVA_HOME/lib/
export PATH=$ PATH:$ JAVA_HOME/bin

After editing, save and exit, then enter the following command to refresh the environment configuration to make it effective
source /etc/profile
5. To check whether jdk is installed successfully, enter the command java -version.

Guess you like

Origin blog.csdn.net/weixin_44809686/article/details/90583496