Installation and Configuration under Ubuntu Jdk

jdk under ubuntu, open jdk and oracle jdk divided into two, the former is open source, in fact, will do. But still oracle jdk most people use.

Some blog recommended to install a ppa way, but the link was installed wall, so often fail to install. Now introduce another, manually extract the installation.

1. Download and unzip

Oracle to go to the official website, download linux, 64-bit installation package, tar.gz here for an example. Link below
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Create a directory:

sudo mkdir /usr/lib/jvm

Unzip into the directory ::

sudo tar -zxvf jdk-7u60-linux-x64.gz -C /usr/lib/jvm

2. Configure Environment Variables

sudo gedit /etc/profile

Finally, add the following files:

#set Java environment
JAVA_HOME Export = / dengyang / jdk1. 8 .0_231 # here according to their own version of jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

After modifications are complete save close.

Let environment variables to take effect:

source /etc/profile 

3. Enter java -version, display JDK Release Notes Congratulations, environment variables configured correctly

Guess you like

Origin www.cnblogs.com/51ma/p/12033561.html