Uninstall openjdk Java and install Sun Java in ubuntu12.04

Source: Internet
Author: User

I started to find openjdk Java in the Ubuntu Software Center. When I used the uninstall option, the system prompts that the network link failed ?!! To uninstall a software package, you need to download a wool package and delete the directory/usr/lib/JVM.

Then execute:

1.download jdk-7u15-linux-i586-demos.tar.gz on sun's official website,

2. Create the directory/usr/lib/JVM: sudo mkdir/usr/lib/JVM.

3. Unzip the installation package. Tar-zxvf jdk-7u15-linux-i586-demos.tar.gz and copy it to the target directory: CP-A jdk1.7.0 _ 15
/Usr/lib/JVM/. You cannot directly decompress the package to the target folder because the-C parameter is missing. The correct command is: tar-zxvf jdk-7u15-linux-i586-demos.tar.gz
-C/usr/lib/JVM ]. You have to decompress the package before copying it. Because the File Permission cannot be changed, the-a parameter must be used for the CP command.

Then configure the Java environment variable:

Set the environment variable: Vim ~ /. Bashrc

Export java_home =/usr/lib/JVM/jdk1.7.0 _ 15

Export jre_home =$ {java_home}/JRE export classpath =. :. {java_home}/lib :$ {jre_home}/lib export path =$ {java_home}/bin: $ path


Close the terminal and open it again


Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/jdk1.7.0 _ 15/bin/Java 300 sudo Update-alternatives -- install/usr/bin/javac javac/usr/lib/JVM/jdk1.7.0 _ 15/bin/javac 300
========================================================== ========================================================== ======= If there are other Java versions installed on the machine, select:

Input:

Update-alternatives -- config Java

Display:

Select the path priority status

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

* 0/usr/lib/JVM/java-6-openjdk/JRE/bin/Java 1061 automatic mode

1/usr/lib/JVM/java-6-openjdk/JRE/bin/Java 1061 manual mode

2/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 manual mode

 

Enter the selected number: 2

Enter

 

4. Verify that the Java-version has been changed to Sun's JRE.


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.