English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article shares the JDK installation and configuration method on Linux for everyone's reference, the specific content is as follows
First, environment
VMware12 Pro
CentOS-6.7-i386-bin-DVD1
jdk-8u151-linux-i586
Second, detailed installation steps prerequisite: need to uninstall JDK on your Linux
rpm-qa| grepjdk will display all the installation packages that contain the string jdk
rpm-e--nodeps corresponding to each package name will uninstall the corresponding package
After that, if java -version shows
that's all. It's done.
I have installed JDK before1.7Therefore, I need to uninstall, and if you haven't installed it, start from the following
1download JDK from the official website
you need to select the small circle marked in red in the picture, which means you accept the license agreement
Because my virtual system is32bit, so I downloaded32bit JDK, according to your specific situation86Represents32bit system, x64Represents64bit system.
Don't know what system the server is, just use this command:
2. Upload and Unzip JDK
Someone may not know what the rz command is. Why don't you have it?
This is a simple upload and download tool. If you haven't installed it before, you can install it, it's very useful
Check if lrzsz is installed before installation:
rpm –q l lrzsz
If not installed, you can use the following command to install:
yum install lrzsz –y
After that, you can use rz to upload local files to the current directory of the server, and sz followed by the specified file directory can download it to the local machine
Alright, after uploading JDK, it looks like this:
Unzip, etc., a bit slow, so it's unzipped to the current directory:
3. Move the location
To facilitate management in the future, I moved the JDK directory to a different location and renamed it
Now let's go and see the JDK, ok, JDK1.8It already exists, that JDK1.7Don't worry, it's one I installed before
The ls | grep jdk command is a pipeline command. It lists the files in the current directory and searches for those containing jdk to display
4. Configure Environment Variables
First use vim to open/etc/profile
Add it at the bottom of the file, save and exit
Run the following command to make the configuration take effect immediately
Now through java -version and javac -Check the version command, the two results are the same
OK, JDK configuration completed!
That's all for this article. I hope it will be helpful to everyone's learning and that everyone will support the Yelling Tutorial more.
Declaration: The content of this article is from the Internet, and the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously. This website does not own the copyright, has not been manually edited, and does not assume any relevant legal liability. If you find any copyright-infringing content, please send an email to: notice#w3Please report via email to codebox.com (replace # with @ when sending an email) and provide relevant evidence. Once verified, this site will immediately delete the infringing content.