Article Title: Install JDK in ubuntu8.04. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Step 1. Depending on the configuration of your machine, select the http://java.sun.com/javase/downloads/index.jsp to download JDK from the sun official website, I downloaded the jdk_6u6_linux-x64.bin.
Step 2. Click "application"> "attachment"> "terminal" on the desktop to enter the terminal window, enter the sudo su command, and obtain the root permission.
Step 3. Create a subdirectory java under the/usr directory, copy the downloaded jdk_6u6_linux-x64.bin to the directory, and enter the command on the terminal
# Mkdir/usr/java
# Ls/home/casa2/desktop
# Cp-fr/home/casa2/desktops/jdk_6u6_linux-x64.bin/usr/java
Casa2 is my user name, and firefox's default download is on the desktop.
Step 4. Go to the/usr/java directory, start to install jdk, and enter the following command on the terminal:
# Cd/usr/java
# Chmod u + x./jdk_6u6_linux-x64.bin
#./Jdk_6u6_linux-x64.bin
The installer will ask you if you want to abide by the license agreement page. Press enter and enter a space.
A line appears: Do you aggree to the above license terms? [Yes or no]
After you enter yes, jdk is decompressed to the usr/java/jdk1.6.0 _ 06 directory.
Step 5. Modify the environment variable, set PATH, JAVA_HOME, CLASSPATH, and use the gedit editor to modify the profile file. The modification will take effect for all users and change it. I used the vi editor in many places on the Internet. I tried to use gedit.
# Gedit/etc/profile
Add the following statements before umask 022 at the end of the pop-up profile file:
Export JAVA_HOME =/usr/java/jdk1.6.0 _ 06
Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH: $ HOMR/bin
Umask 022 // the original file does not move it
Save and exit.
Step 6. Test whether jdk is successfully installed
Log out of the terminal, log out, and enter the terminal again. Enter java-version to check the jdk version,
Java version "1.6.0 _ 06"
Java (TM) SE Runtime Environment (build 1.6.0 _ 06-b02)
Java HotSpot (TM) 64-Bit Server VM (build 10.0-b22, mixed mode)
The installation is successful.