Ubuntu Replace system OpenJDK

Source: Internet
Author: User

Some Ubuntu comes with a JDK. But sometimes it's exactly what we want. The following describes how to replace the JDK

1. Uninstalling an existing JDK

sudo apt-get purge openjdk-\*

2. Download the JDK.

3. Create a directory under the/usr/local/folder: sudo mkdir -p /usr/local/java

4. Copy the JDK to the third-step folder.

sudo cp -r jdk...tar.gz /usr/local/java/

5. Extracting files

 sudo tar xvzf jdk-8u51-linux-x64.tar.gz

6. Update the path below/etc/profile.

< Span class= "PLN" >    java_home =/usr/local/ java/jdk1. 8.0_51

< Span class= "pun" >< Span class= "PLN" >  path= $PATH : $HOME /bin: $JAVA _home/< Span class= "PLN" >bin

< Span class= "pun" >< Span class= "pun" >< Span class= "PLN" >< Span class= "PLN" >  export java_home

  export PATH

7. Run the following script

sudo update-Alternatives--Install"/usr/bin/java"  "java"  /usr/local/java/jdk1.../bin/ Java " 1sudo update---install  "/usr/bin/javac"  span class= "str" > "Javac"   "/usr/local/java/jdk1.../bin/javac"  1sudo update---install  "/usr/bin/javaws"  "javaws"   "/usr/local/java/jdk1.../bin/javaws"  1 
8.
sudo update-Alternatives--Set Java/Usr/Local/Java/Jdk1.8.0_51/Bin/Javasudo Update-Alternatives--set javac /usr/local< Span class= "pun" >/java/jdk1. 8.0_51/bin/javacsudo Update-alternatives --set javaws /usr/local/ java/jdk1. 8.0_51/bin/javaws   
9. Reload the following script
Source/etc/profile
Ten. Roboot Ubuntu

Ubuntu Replace system OpenJDK

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.