This example shares the installation and configuration method of JDK on Linux for your reference. The specific content is as follows
1. Environment
VMware12 Pro
CentOS-6.7-i386-bin-DVD1
jdk-8u151-linux-i586
2. Detailed installation steps: You need to uninstall your own jdk on Linux
rpm-qa| grepjdk will display all your installation packages containing the string jdk
Each package name corresponding to rpm-e--nodeps will uninstall the corresponding package
After that if java -version displays
Just finished unloading.
I have installed jdk1.7 before, so I need to uninstall it. If you haven't installed it, start from below.
1. Go to the official website to download JDK
Download address
You need to select the small red dot in the picture to put it down, which means you receive the license agreement.
Because my virtual system is 32-bit, I will use 32-bit JDK to see it according to your situation. x86 represents a 32-bit system, and x64 represents a 64-bit system.
I don't know how many bits the server is from, so I just use this command:
2. Upload and unzip JDK
Some people may not know what the rz command is, why don’t you?
This is a simple upload and download tool. If you haven't installed it, you can install it. It's very useful.
Before installing, check whether lrzsz is installed:
rpm ql lrzsz
If not installed, you can use the following command to install:
yum install lrzsz y,
After that, you can use rz to upload the local file to the current directory of the server. SZ followed by the specified file directory and you can download it from the server to the local directory.
OK, this is what jdk uploads:
Unzip, wait a little slow, so you can unzip it to the current directory:
3. Move the lower position
For the sake of easy management in the future, I changed the jdk directory and renamed it
Now let’s take a look at jdk, ok, jdk1.8 already exists, and you don’t have to worry about jdk1.7, it was installed by me before.
ls | grep jdk command is a pipeline command, lists the current directory file and retrieves the display containing jdk
4. Configure environment variables
First use vim to open /etc/profile
Add at the bottom of the file, save and exit
Run the following command to make the configuration take effect immediately
Now check with the java -version and javac -version commands, the two results are the same
OK, jdk configuration is completed!
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.