


How to configure custom JDK in CentOS7
Since the centos7-dvd image selected comes with open jdk, it needs to be uninstalled. First query the built-in jdk:
rpm -qa | grep java
There will be 7 things with java names. Delete the files with openjdk among them. The command is as follows:
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64 rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64 rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64 rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
Execute again rpm -qa | grep java
command, there are only three left:
javapackages-tools-3.4.1-11.el7.noarch tzdata-java-2016g-2.el7.noarch python-javapackages-3.4.1-11.el7.noarch
Then install the jdk you need, first enter the local
directory:
cd /usr/local/
in Create a folder under this directory and name it jdk to store jdk files. Download file:
// wget 地址 wget
Get the url by right-clicking -> copy the link address, and then execute the command. It feels so good and the download speed is so fast!
Then execute the command:
tar -zxvf jdk-8u131-linux-x64.tar.gz
The result is an error, the error message:
gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
After searching online for a long time, I finally found the solution. First, use the file
command to view the real attributes of the file:
file jdk-8u131-linux-x64.tar.gz
Display the result:
[root@localhost jdk]# file jdk-8u131-linux-x64.tar.gz jdk-8u131-linux-x64.tar.gz: HTML document, ASCII text, with very long lines, with CRLF line terminators
It turns out that the downloaded web page (html) is what I said about a few hundred megabytes of stuff? It opens in seconds. Then you can only download it manually, and then execute the rz
command, select the downloaded file and transfer it to the Linux virtual machine, and perform decompression:
tar -zxvf jdk-8u131-linux-x64.tar.gz
The decompressed file is:
drwxr-xr-x. 8 10 143 4096 3月 15 16:35 jdk1.8.0_131
Delete the compressed file (optional):
rm -f jdk-8u131-linux-x64.tar.gz
Configure environment variables:
vim /etc/profile
Enter i
to enter edit mode and add environment variables at the end of the file:
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_131 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
Press the esc
key and enter wq
(save and exit).
After saving, make the newly configured environment take effect:
source /etc/profile
Check whether the jdk installation is complete:
java -version
Display the result:
[root@localhost jdk]# java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
indicates that the configuration is successful.
The above is the detailed content of How to configure custom JDK in CentOS7. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

When loading CentOS-7.0-1406, there are many optional versions. For ordinary users, they don’t know which one to choose. Here is a brief introduction: (1) CentOS-xxxx-LiveCD.ios and CentOS-xxxx- What is the difference between bin-DVD.iso? The former only has 700M, and the latter has 3.8G. The difference is not only in size, but the more essential difference is that CentOS-xxxx-LiveCD.ios can only be loaded into the memory and run, and cannot be installed. Only CentOS-xxx-bin-DVD1.iso can be installed on the hard disk. (2) CentOS-xxx-bin-DVD1.iso, Ce

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

1. The picture below is the default screen layout of edius. The default EDIUS window layout is a horizontal layout. Therefore, in a single-monitor environment, many windows overlap and the preview window is in single-window mode. 2. You can enable [Dual Window Mode] through the [View] menu bar to make the preview window display the playback window and recording window at the same time. 3. You can restore the default screen layout through [View menu bar>Window Layout>General]. In addition, you can also customize the layout that suits you and save it as a commonly used screen layout: drag the window to a layout that suits you, then click [View > Window Layout > Save Current Layout > New], and in the pop-up [Save Current Layout] Layout] enter the layout name in the small window and click OK

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

In an excel table, sometimes you may need to insert coordinate axes to see the changing trend of the data more intuitively. Some friends still don’t know how to insert coordinate axes in the table. Next, I will share with you how to customize the coordinate axis scale in Excel. Coordinate axis insertion method: 1. In the excel interface, select the data. 2. In the insertion interface, click to insert a column chart or bar chart. 3. In the expanded interface, select the graphic type. 4. In the right-click interface of the table, click Select Data. 5. In the expanded interface, you can customize it.
