Home >Operation and Maintenance >Linux Operation and Maintenance >About the installation and configuration method of jdk in Ubuntu system

About the installation and configuration method of jdk in Ubuntu system

黄舟
黄舟Original
2017-06-06 10:35:111462browse

1. jdkInstallation

Download the jdk tar package. Assume that the directory where the tar package is located is /home/username/Download. Use Use the following command to decompress the tar package

tar -zxf /home/username/Download/jdk-8u77-linux-x64.tar.gz

After decompression is completed, move the decompressed package to the installation directory, assuming it is /home/username/develop

mv jdk1.8.0.7 /home/username/develop

For the convenience of operation, rename the jdk installation directory. Enter the develop directory

mv jdk1.8.0.7 jdk

2.Set environment variables

Edit the .bashrc file in the username directory, that is /home/username/.bashrc, the command is

vim /home/username/.bashrc

Add the following to the beginning of the .bashrc file:

(1) Set up jdk, jre installation path variable

export JAVA_HOME=/home/username/develop/jdk
export JRE_HOME=${JAVA_HOME}/jre

(2) Add the jdk lib directory and jre lib directory to the CLASSPATH environment variable

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

(3) Add the bin directory of jdk to the PATH environment variable

export PATH=${JAVA_HOME}/bin:$PATH

(4) Right. Run the source command on the bashrc file to make the settings take effect immediately

source /home/username/.bashrc

(5) Run the java -version command to check whether the setting is successful

The above is the detailed content of About the installation and configuration method of jdk in Ubuntu system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn