Install and configure Java JDK in Ubuntu 12.04. First, download the jdkzip package under linux. I downloaded the jdk-7u4-linux-i586.tar.gz file. After the file is downloaded, decompress it directly.
Step 1:
# Copy the extracted jdk1.7.0 _ 21 folder to the/usr/lib/jvm directory with the highest Permissions
Sudo cp-r ~ /Jdk1.7.0 _ 21 // usr/lib/jvm/jdk1.7.0 _ 21
Step 2:
# Configure Environment Variables
Sudo gedit ~ /. Profile
Add:
Export JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 21
Save and close, and use source to update
$ Source ~ /. Profile
Use the env command to view the JAVA_HOME Value
$ Env
If JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 21, the configuration is successful.
Step 3:
# Modify the system's default jdk
$ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7.0 _ 21/bin/java 300
Just enter the number before sun jdk.
$ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/jdk1.7.0 _ 21/bin/javac 300
$ Sudo update-alternatives -- config java
$ Sudo update-alternatives -- config javac
Step 4:
Then enter java-version. The following information is displayed, indicating that the jdk is changed to sun:
Java version "1.7.0 _ 04"
Java (TM) SE Runtime Environment (build 1.7.0 _ 04-b20)
Java HotSpot (TM) Server VM (build 23.0-b21, mixed mode)
Possible problems:
1. The error message "libjli. so cannot be started" is displayed ......, This problem occurs because the downloaded Java JDK package is incomplete or your decompression method is incorrect. Directly decompress the package to the current path and copy it to the desired directory, the JDK installation directory can be selected at will, for example, you can put it under the HOME Directory,
The libjli. so file is in :~ /Jdk1.7.0 _ 07/jre/lib/i386/jli/libjli. so
2. The configuration may fail. You need to uninstall the previously installed OpenJDK. You can run the command line to remove it.
3. for JDK of different versions, modify the version above.
Install JDK 7 In Ubuntu (with Clojure download)
Install JDK 12.04 in Ubuntu