First, download JDK from the official Oracle website. Bytes. Go to the directory where the jdk-6u31-linux-i586.bin is located 1) Change file permissions sudochmodu + x
First, download JDK from the official Oracle website.
Http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html
Here I downloaded the jdk-6u31-linux-i586.bin.
Go to the directory where the jdk-6u31-linux-i586.bin is located
1) Change File Permissions
Sudo chmod u + x jdk-6u31-linux-i586.bin
2) install JDK
Sudo-s./jdk-6u31-linux-i586.bin
Press enter and enter yes.
Configure Environment Variables
Run sudo gedit/etc/profile
Open the profile file, enter the following content at the bottom of the profile file, and save it.
# Set java environment
Export JAVA_HOME =/home/wenqisun/swq/jdk1.6.0 _ 31
Export JRE_HOME =/home/wenqisun/swq/jdk1.6.0 _ 31/jre
Export CLASSPATH = ".: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH"
Export PATH = "$ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH"
Restart the computer and enter java-version to view the java version information. If the following result is displayed, the configuration is successfully installed.
Www.linuxidc.com @ Ubuntu :~ $ Java-version
Java version "1.6.0 _ 31"
Java (TM) SE Runtime Environment (build 1.6.0 _ 31-b04)
Java HotSpot (TM) Client VM (build ipv6-b01, mixed mode, sharing)
Www.linuxidc.com @ ubuntu :~ $
How to uninstall JDK:
In Terminal, enter the JDK directory and run the rm command to delete the JDK.
Then, use sudo gedit/etc/profile to open the profile and modify the JDK environment variables to completely delete the JDK environment.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2