Centos7.5 installation configuration for the Java environment

Source: Internet
Author: User

1. View the Java environment in the system

[Email protected] ~]# java-version
OPENJDK Version "1.8.0_101"
OpenJDK Runtime Environment (build 1.8.0_101-b13)
OpenJDK 64-bit Server VM (build 25.101-b13, Mixed mode)

To view the JDK information further:

[Email protected] ~]# Rpm-qa | grep java
Javapackages-tools-3.4.1-11.el7.noarch
Java-1.8.0-openjdk-headless-1.8.0.101-3.b13.el7_2.x86_64
Python-javapackages-3.4.1-11.el7.noarch
Tzdata-java-2016f-1.el7.noarch
Java-1.8.0-openjdk-1.8.0.101-3.b13.el7_2.x86_64

Uninstalling Openjdk:rpm-e--nodeps

[Email protected] ~]# rpm-e--nodeps javapackages-tools-3.4.1-11.el7.noarch
[Email protected] ~]# rpm-e--nodeps java-1.8.0-openjdk-headless-1.8.0.101-3.b13.el7_2.x86_64
[Email protected] ~]# rpm-e--nodeps python-javapackages-3.4.1-11.el7.noarch
[Email protected] ~]# rpm-e--nodeps tzdata-java-2016f-1.el7.noarch
[Email protected] ~]# rpm-e--nodeps java-1.8.0-openjdk-1.8.0.101-3.b13.el7_2.x86_64

2. Installing the JDK

Download the JDK RPM installation package to upload to/usr/local/java

: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Cd/usr/local/java Enter the folder where the JDK is located to execute the Install command:

[Email protected] java]# RPM-IVH jdk-8u91-linux-x64.rpm
In preparation ... ################################# [100%]
Upgrading/installing ...
1:jdk1.8.0_91-2000:1.8.0_91-fcs ################################# [100%]
Unpacking JAR files ...
Tools.jar ...
Plugin.jar ...
Javaws.jar ...
Deploy.jar ...
Rt.jar ...
Jsse.jar ...
Charsets.jar ...
Localedata.jar ...
Jfxrt.jar ...

Installation succeeds without error

Verify:

[Email protected] java]# java-version
Java Version "1.8.0_91"
Java (TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot (TM) 64-bit Server VM (build 25.91-b14, Mixed mode)

3. Environment variable Setting

Modify the System environment variable file
VI +/etc/profile

[Email protected] java]# VI +/etc/profile

Fi

Hostname= '/usr/bin/hostname 2>/dev/null '
histsize=1000
If ["$HISTCONTROL" = "ignorespace"]; Then
Export Histcontrol=ignoreboth
Else
Export Histcontrol=ignoredups
Fi

Export PATH USER LOGNAME MAIL HOSTNAME histsize Histcontrol

java_home=/usr/java/jdk1.8.0_91
Jre_home=/usr/java/jdk1.8.0_91/jre
path= $PATH: $JAVA _home/bin: $JRE _home/bin
classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
export java_home jre_home PATH CLASSPATH

# By default, we want Umask to get set. This sets it for login shell
# current threshold to system reserved Uid/gids is 200
# could check Uidgid reservation validity in
#/usr/share/doc/setup-*/uidgid File
If [$UID-gt 199] && ["' id-gn '" = "' Id-un '"]; Then
Umask 002
Else
Umask 022
Fi

For I in/etc/profile.d/*.sh; Do
If [-R "$i"]; Then
if ["${-#*i}"! = "$-"]; Then
. "$i"
Else
. "$i" >/dev/null
Fi
Fi
Done

unset I
Unset-f Pathmunge
"/etc/profile" 82L, 1972C

Red font for added settings, usually Java installed in the/usr/java/directory

Make the changes effective
[[email protected] ~]# source/etc/profile//Make changes effective immediately

Verify the configuration:

[Email protected] java]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.8.0_91/bin:/usr/java/jdk1.8.0_91/ Jre/bin

This completes the configuration of the entire Java environment

Centos7.5 installation configuration for the Java environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.