Install jdk in ubuntu
The detailed steps for installing jdk1.7 in ubuntu14 are as follows:
http://www.cnblogs.com/plinx/archive/2013/06/01/3113106.html
1. Download from Sun's official website
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Select accept license, and then select JDK download suitable for your model.
2. decompress the file and modify the file name.
/× First enter the administrator privilege ×/
$ Sudo-I
/× Create a directory and decompress the file to the Created directory. ×/
# Mkdir/usr/lib/jvm # tar zxvf jdk-7u65-linux-i586.tar.gz-C/usr/lib/jvm
/× The following command is used to establish a soft connection ×/# ln-s/usr/lib/jvm/jdk1.7.0 _ 65/usr/lib/jvm/jdk1.7
/× Exit the Administrator permission ×/
# Exit
3. Add the environment variables at the end of the bashrc configuration file (the environment variables set here are only valid for the current user, and the. bashrc configuration files must be set for other users)
$ vim ~/.bashrc
Add the following content
Export JAVA_HOME =/usr/lib/jvm/jdk1.7export JRE_HOME =$ {JAVA_HOME}/jre export CLASSPATH =.: $ {JAVA_HOME}/lib :$ {JRE_HOME}/lib export PATH =$ {JAVA_HOME}/bin: $ PATH
/× Press esc and enter: wq to save and exit */
4. Configure the default JDK version.
/× Enter the Administrator permission, and then execute the following update-alternatives command ×/
$ Sudo-I
# Update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7/bin/java 300 # update-alternatives -- install/usr/bin/javac/ usr/lib/jvm/jdk1.7/bin/javac 300 # update-alternatives -- install/usr/bin/jar/usr/lib/jvm/jdk1.7/bin/jar 300 # update -alternatives -- install/usr/bin/javah/usr/lib/jvm/jdk1.7/bin/javah 300 # update-alternatives -- install/usr/bin/javap/usr/ lib/jvm/jdk1.7/bin/javap 300
Then execute
# update-alternatives --config java
# update-alternatives --config javac
# update-alternatives
If JDK is installed for the first time, a prompt is displayed.
There is only one alternative in link group java (providing/usr/bin/java):/usr/lib/jvm/java/bin/java requires no configuration.
If it is not the first installation, you will be prompted to enter the JDK option serial number, and then enter your own jdk serial number.
5. Exit the Administrator permission and Test
# exit
$ java -versionjava version "1.7.0_65"Java(TM) SE Runtime Environment (build 1.7.0_65-b17)Java HotSpot(TM) Server VM (build 24.15-b04, mixed mode)
How to install JDK in ubuntu
Run the following command to install ubuntu:
Sudo apt-get install openjdk # openjdk is an open-source jdk package, which is compatible;
Sudo apt-get install sun-jdk # This is the linux version officially released by sun. Press the tab key when you enter sun-to view the related software packages.
How to install jdk in ubuntu 1204
Search for OpenJDK installation in the Software Center.
If you want to install the official JDK, you can download and install it on the official website. I personally think OpenJDK can fully meet your needs.