Reinstall the JDK that comes with Linux

Source: Internet
Author: User

To view the version of a JDK that is already installed on this computer:

[[email protected] ~]# Java-versionjava version "1.6.0" OpenJDK Runtime Environment (build 1.6.0-b09) OpenJDK Client VM (b Uild 1.6.0-b09, Mixed mode)


If it's not the JDK you need, how do I uninstall it? And how do you install the JDK you need?

Uninstall jdk****************************** installed on this machine

First find the JDK that the system has installed by using the following command:

[Email protected] ~]# Rpm-qa | grep jdkjava-1.6.0-openjdk-devel-1.6.0.0-1.2.b09.el5java-1.6.0-openjdk-1.6.0.0-1.2.b09.el5[[email protected] ~]# Rpm-qa|grep gcjjava-1.4.2-gcj-compat-1.4.2.0-40jpp.115libgcj-4.1.2-46.el5libgcj-src-4.1.2-46.el5java-1.4.2-gcj-compat-src-1.4.2.0-40j pp.115libgcj-devel-4.1.2-46.el5java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.115


Uninstall method One: to uninstall the JDK using Yum, the prerequisite is that this machine has a Yum source configured, and the uninstall method is as follows:

[Email protected] ~]# yum-y Remove Java-1.6.0-openjdk-devel-1.6.0.0-1.2.b09.el5

Follow this method, and then click Uninstall:

    • Java-1.6.0-openjdk-devel-1.6.0.0-1.2.b09.el5

    • Java-1.6.0-openjdk-1.6.0.0-1.2.b09.el5

    • java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

    • java-1.4.2-gcj-compat-src-1.4.2.0-40jpp.115

    • java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.115


Uninstall Method Two: use the rpm command to uninstall:

    • Rpm-e java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

    • Rpm-e java-1.4.2-gcj-compat-devel-l.4.2.0-40jpp.115

    • Rpm-e java-1.4.2-gcj-compat-src-l.4.2.0-40jpp.115

If there is a dependency, the prompt cannot be uninstalled, and the rpm-e--nodeps Uninstall is OK.


Then in the input: java-version

Tip:-bash:/usr/bin/java:no such file or directory


Install the required jdk******************************

JDK Download: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

To install the latest jdk:jdk-6u38-linux-x64.bin, for example:


1, upload to the server sftp;

Sftp> put E:\mcbfile\09.Tools\JDK\Linux_jdk\jdk-6u38-linux-x64.bin./uploading jdk-6u38-linux-x64.bin to/root/ Jdk-6u38-linux-x64.binskipping directory c:/users/administrator/documents 100% 70369KB 2069kb/s 00:00:34 E:/JDK/Lin ux_jdk/jdk-6u38-linux-x64.bin:72058033 bytes transferred in seconds (2069 kb/s) sftp>


2. Use command: chmod a+x jdk-6u38-linux-x64.bin make JDK Execute permission


3, Installation:./jdk-6u38-linux-x64.bin

Gets: jdk1.6.0_38

Move to MV jdk1.6.0_38 /usr/local/jdk1.6.0_38


To create a soft connection:ln-s/usr/local/jdk1.6.0_38/usr/local/java


4. Configure Environment variables

Export Java_home=/usr/local/javaexport path= $PATH: $JAVA _home/bin: $PATHexport classpath=.: $JAVA _home/lib.dt.jar:$ Java_home/lib/tools.jarexport jre_home= $JAVA _home/jre


5. Check to confirm JDK version

[[email protected] ~]# Java-versionjava version "1.6.0_35" Java (TM) SE Runtime Environment (build 1.6.0_35-B10) Java HOTSPO T (TM) 64-bit Server VM (build 20.10-b01, Mixed mode)


----This, the system's JDK has been completely replaced.


--------------------------------------------------------------------------

This is after the hermit, I do before Tangke, drunken dance by the Pavilion Half volume book, sit well said days wide.

Ambition play fame and fortune, the sea bucket volume blessing, on the purse in the shy, anger refers to the universe is wrong.


This article is from the "Cold Tea" blog, please be sure to keep this source http://miaocbin.blog.51cto.com/689091/1863743

Reinstall the JDK that comes with Linux

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.