Ubuntu install JDK and environment variable configuration Ubuntu install JDK and environment variable configuration

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

 

8. Test


 

The following message appears:
 version "1.8.0_77"

(TM) SE Runtime Environment (build 1.8.0_77-b03)

 HotSpot(TM) Client VM (build 25.77-b03, mixed mode)

jdk installed successfully.

 

Nine, write a piece of java code to test


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

 

8. Test


 

The following message appears:
 version "1.8.0_77"

(TM) SE Runtime Environment (build 1.8.0_77-b03)

 HotSpot(TM) Client VM (build 25.77-b03, mixed mode)

jdk installed successfully.

 

Nine, write a piece of java code to test


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326685056&siteId=291194637