In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today Xiaobian to share with you about Linux uninstall openjdk and install sunJDK method related knowledge, the content is detailed, logic is clear, I believe most people still know too much about this knowledge, so share this article for your reference, I hope you can get something after reading this article, let's take a look at it.
Openjdk is the open source version of jdk and is released in the form of GPL protocol.
1. Download JDK
According to the number of bits of the operating system to download the corresponding JDK, the operating system is 32-bit, the next 32-bit JDK,64, the next 64-bit JDK. Linux x86 is 32-bit JDK,Linux x64 is 64-bit JDK.
The JDK installation package under Linux is available in .rpm and .tar.gz formats. Rpm is the standard installation package for redhat Red Hat and is automatically configured when rpm is installed.
This installation example is carried out under the CentOS system, and other types of Linux systems are installed in the same way. The downloaded JDK version is 1.7.0x79. As for the installation methods of .rpm and .tar.gz, we have downloaded files in both formats.
Jdk-7u79-linux-x64.rpm
Jdk-7u79-linux-x64.tar.gz
Download address: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2. Uninstall JDK
Check to see if JDK is installed on the system. The general linux uses the open source openJDK by default. JDK version information is displayed. JDK is already installed, otherwise it is not installed. Command line:
Java-version [root@localhost Desktop] # java-version
Java version "1.6.0"
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)
Find an installed program whose name contains java,jdk. Found that JDK is already installed, otherwise it is not installed. Command line:
Rpm-qa | grep java rpm-qa | grep jdk [root@localhost Desktop] # rpm-qa | grep java
[root@localhost Desktop] # rpm-qa | grep jdk
Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
OpenJDK is installed and openJDK is uninstalled on the system.
A single uninstall program, using the rpm-e-nodeps xxx command. Command line:
Rpm-e-- nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 rpm-e-- nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5 batch uninstalls all installed programs whose names include jdk. Command line:
Rpm-qa | grep jdk | xargs rpm-e-- nodeps batch uninstalls all installed programs whose names include java. Command line:
Rpm-qa | grep java | xargs rpm-e-- nodeps if the openjdk source cannot be found, you can also uninstall it as follows:
After uninstalling yum-y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 yum-y remove java java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5, check the JDK version. There is no information. The uninstall is successful.
[root@localhost Desktop] # java-version
Bash: / usr/bin/java: No such file or directory
3. Install JDK
* * if you install 32-bit JAVA under CentOS x64, you need to install 32-bit glibc.i686 and libgcc.i686
# sudo yum install glibc.i686 # sudo yum install libgcc.i686 sometimes you need to force multiple libgcc versions to be installed, and you need to:
# sudo yum-setopt=protected_multilib=false install libgcc.i6863.1, .rpm suffix format JDK installation method
Install jdk-7u79-linux-x64.rpm.
Add permissions to the installation package. Command line:
Chmod 755 jdk-7u79-linux-x64.rpm [root@localhost Desktop] # chmod 755 jdk-7u79-linux-x64.rpm
Use the rpm-ivh xxx command to install JDK. Command line:
Rpm-ivh jdk-7u79-linux-x64.rpm [root@localhost Desktop] # rpm-ivh jdk-7u79-linux-x64.rpm
Preparing... # [100%]
1:jdk # # [100%]
Unpacking JAR files...
Rt.jar...
Jsse.jar...
Charsets.jar...
Tools.jar...
Localedata.jar...
Jfxrt.jar...
Installing JDK with a .rpm suffix does not need to configure the java environment variable. It will be configured automatically. Shortcut icons for java, javac and other JDK will be generated in / usr/bin, and these icons will be linked to / usr/java/jdk1.7.0_79. Looking at the environment variable with echo $PATH, you can see that / usr/bin is added to the PATH environment variable. Command line:
Echo $PATH [root@localhost Desktop] # echo $PATH
/ usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
3.2. tar.gz suffix format JDK installation method
Decompression and installation
Sudo tar zxvf. / jdk-7u79-linux-x64.tar.gz-C / usr/lib/jvm cd / usr/lib/jvm sudo mv jdk1.7.0/ java-7-sun modifies environment variables
Open the .bashrc file in the user directory with a text editor and add at the end of the .bashrc file:
JAVA_HOME=/usr/lib/jvm/java-7-sun export JAVA_HOME JRE_HOME=/usr/lib/jvm/java-7-sun/jre export JRE_HOME PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export CLASSPATH save exit, enter the following command to make it effective immediately.
Source / .bashrc
After the installation is complete, check the JDK version. Command line:
Java-version [root@localhost Desktop] # java-version
Java version "1.7.079"
Java (TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot (TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Installation succeeded.
These are all the contents of this article entitled "how to uninstall openjdk and install sunJDK in Linux". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.