1. Go to the official Oracle website to download java7sdkhttp: // response. Generally, there is no jvm folder in the/usr/lib folder.
1. Go to the official Oracle website to download the Java 7 sdk
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Here I downloaded the latest java1.7.0 _ 07
2. Extract
Decompress the downloaded jdk-7u7-linux-i586.tar.gz and put it in the/usr/lib/jvm folder. Generally, the/usr/lib Folder does not have a jvm folder. You need to create it manually. The author uses the root administrator account to log on (sudo passwd root), so it can be directly created in the lib folder. For non-root login, run the following command:
Sudo mkdir/usr/lib/jvm
3. Modify Environment Variables
Enter at the terminal:
Vim ~ /. Bashrc
Vim commands are unfamiliar. You can search for information on the Internet. There are many
Then add the following code (I insert ):
Export JAVA_HOME =/usr/lib/jvm/java1.7.0 _ 07
Export JRE_HOME =$ {JAVA_HOME}/jre
Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib
Export PATH =$ {JAVA_HOME}/bin: $ PATH
Save and exit (ESC +: wq), and enter the following command to make it take effect immediately
Source ~ /. Bashrc
Ps:/etc/profile setting method is valid for all logged-on users .~ /. Bashrc is only valid for the current user.
Both of the above are configuration files. After the instance is started, the system will first read/etc/profile and then read ~ /. Bashrc. Different users ~ The/. bashrc file can have different settings,
The/etc/profile is shared and can be modified only by the root user .~ /. Bashrc applies append coverage to/etc/profile.
4. Test
Enter the java-version command. If the result is as follows, the installation is correct.
Root @ ubuntu :~ # Java-version
Java version "1.7.0 _ 07"
Java (TM) SE Runtime Environment (build 1.7.0 _ 07-b10)
Java HotSpot (TM) Server VM (build 23.3-b01, mixed mode