Ubuntu install JDK with environment variable configuration

1. getconf LONG_BIT View the system bits and download the corresponding jdk.
My system is 32-bit, so the downloaded jdk is: jdk-8u77-linux-i586.gz.
And put it in the /home/injavawetrust/software directory.

 

2. Create a directory /usr/lib/jvm so that the downloaded and decompressed packages can be placed in this directory.
cd /usr/lib
sudo mkdir jvm

 

3. Unzip and put the unzipped jdk folder in the /usr/lib/jvm directory
cd /home/injavawetrust/software
sudo tar zxvf jdk-8u77-linux-i586.gz -C /usr/lib/jvm


Fourth, enter the /usr/lib/jvm directory
cd /usr/lib/jvm

 

5. Rename the decompressed jdk folder to java1.8
sudo mv jdk1.8.0_77 java1.8

 

6. First enter the vi editor, and then enter the following command
vi ~/.bashrc The command
entered in the opened file is as follows:



 
Seven, execute the command
source ~/.bashrc

 

Eight, test
java -version

出现如下信息:
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) Client VM (build 25.77-b03, mixed mode)

jdk安装成功。

 

九、写段java代码测试一下



 

QQ技术交流群290551701 http://cxy.liuzhihengseo.com/560.html


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325473146&siteId=291194637
Recommended