linux install jdk environment

linux install jdk environment

Tags: linux


### 1. To obtain root privileges to install global

 $ sudo -s -H
[sudo] ni 的密码:

Here Insert Picture Description

### 2. Before installing Java, be sure to check the Java version installed.
java -version java version command to check the abdication

# java -version  
java version "1.8.0_181"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-2)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

Here Insert Picture Description
### 3. To install the Java directory. Access to the global (all users) it is best to install directory / opt / java.

# cd /opt/                //进入opt目录
# mkdir java/             //创建java目录
# cd java                 //进入java目录

Here Insert Picture Description

4. go [Official Download] [4] Java (JDK) 8u231 source package file

Java (JDK) 8u231 is a jdk8 new 2019 version [version history go here] [5]

Alternatively, you can use wget command to download files directly to / opt / java, as shown in Fig directory

5. Once the file is downloaded, you can use the extracting archive tar command, as shown below.

# tar -zxvf jdk-8u231-linux-i586.tar.gz		        [For 32-bit Systems]
# tar -zxvf jdk-8u231-linux-x64.tar.gz.tar.gz		[For 64-bit Systems]

Here Insert Picture Description6. Next, the extracted directory, and then use the command update-alternatives, and it tells where the Java executable file system installed.

# cd jdk1.8.0_231/
# update-alternatives --install /usr/bin/java   java   /opt/java/jdk1.8.0_231/bin/java 100  
# update-alternatives --config java

Here Insert Picture Description
Update Java alternative

7. javac tells the system to update the alternatives:

# update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.8.0_231/bin/javac 100
# update-alternatives --config javac

Here Insert Picture Description

Update replacement Javac

8. Also, the update jar alternatives:

# update-alternatives --install /usr/bin/jar jar /opt/java/jdk1.8.0_231/bin/jar 100
# update-alternatives --config jar

Here Insert Picture Description

Update Jar alternatives

9. Set up Java environment variables.

# export JAVA_HOME=/opt/java/jdk1.8.0_231/	
# export JRE_HOME=/opt/java/jdk1.8.0.0_231/jre 	
# export PATH=$PATH:/opt/java/jdk1.8.0_231/bin:/opt/java/jdk1.8.0_231/jre/bin/

Here Insert Picture Description
Setting up the Java environment variables

### 10 Now you can re-verify the Java version, for confirmation.

# java -version

Here Insert Picture Description
### 11. To enable the Java JDK 8 in Firefox support 8u231, you need to run the following command to enable Firefox's Java module
#### in Debian, Ubuntu and Mint

--------------- For 32-bit Systems ---------------
# alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_231/jre/lib/i386/libnpjp2.so 20000
--------------- For 64-bit Systems ---------------
# alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_231/jre/lib/amd64/libnpjp2.so 20000

#### on RHEL, CentOS and Fedora

--------------- For 32-bit Systems ---------------
# alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_231/jre/lib/i386/libnpjp2.so 20000
--------------- For 64-bit Systems ---------------
# alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_231/jre/lib/amd64/libnpjp2.so 20000

### 12 Now restart Firefox and verify Java support enter about: plugins. You will get a screen like this.
Here Insert Picture Description

forward from

Published 30 original articles · won praise 0 · Views 6650

Guess you like

Origin blog.csdn.net/qq_37710756/article/details/103260100
Recommended