Detailed steps for UBUNTU manual installation of JDK

  • 2020-05-07 20:46:10
  • OfStack

First go to Oracle to download the JDK package under Linux. I downloaded the jdk-7u4-linux-i586.tar.gz file

# copies the unzipped jdk1.7.0_04 folder with the highest permissions to the /usr/lib/jvm directory
sudo cp -r ~/jdk1.7.0_04/ /usr/lib/jvm/

# configures environment variables

sudo gedit ~/.profile

Add at the end:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_04

Then save it off and update it with source
$ source ~/.profile

Use the env command to see the value of JAVA_HOME
$ env
If JAVA_HOME = / usr/lib jvm/jdk1. 7.0 _04 configured successfully.


#  Will the system default jdk Change to come over 
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 300 

Enter the number before sun jdk

$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 300 
$ sudo update-alternatives --config java 
$ sudo update-alternatives --config javac

Then enter java-version, see the following information, it means to change jdk 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. libjli is cannot be started... , the problem is that the JavaJDK package you downloaded is not complete, or your unzip mode is not correct, directly unzip to the current path, and then copy to the directory you need, JDK installation directory can be freely selected, such as you can be placed in the HOME directory,
libjli. so files in: ~ / jdk1. 7.0 _07 / jre/lib i386 / jli/libjli so

2. You may not be able to successfully configure and need to uninstall the previously installed OpenJDK, which can be removed from the command line

3. Different versions of JDK, the version number can be modified as above


Related articles: