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