About the installation and configuration method of jdk in Ubuntu system

黄舟
Release: 2017-06-06 10:35:11
Original
1368 people have browsed it

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
Copy after login

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
Copy after login

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

mv jdk1.8.0.7 jdk
Copy after login

2.Set environment variables

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

vim /home/username/.bashrc
Copy after login

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
Copy after login
export JRE_HOME=${JAVA_HOME}/jre
Copy after login

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

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

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

export PATH=${JAVA_HOME}/bin:$PATH
Copy after login

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

source /home/username/.bashrc
Copy after login

(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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!