JDK environment variable configuration method under ubuntu

Check the jdk version, uninstall the openjdk version (the difference between jdk and openjdk is not repeated here)

First check the java -version, javac -version commands to view the version (Figure 1)

After checking the jdk version is 1.7.0.45; then enter rpm -qa|grep java to view (Figure 2)

Note: The openjdk version installed by different CentOS versions may be different; if there is no list displayed, you can go directly to step 4

Uninstall the above three files (root privileges are required, login with root privileges to uninstall) (Figure 3)

rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
rpm -e --nodeps tzdata-java-2013g-1.el6.noarch

Check the jdk information again (Figure 4)

Now you are ready to install the Oracle version of jdk.

Or order to download directly:

[ root@VM_16_4_centos home]
# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.tar.gz

Unzip the jdk, unzip the command: tar -xvzf jdk-7u25-linux-x64.tar.gz

The location of jdk: /home/codebrother/jdk/jdk-7u25-linux-x64.tar.gz, unzip in the current path, after unzip, the jdk folder will appear, enter the jdk directory, and view the contents of the directory ( Figure 5)

Configure jdk environment variables

In the Linux system, you need to add the jdk bin directory in the PATH, create a CLASSPATH, and add the jdk lib directory.

Jdk's home directory: /home/codebrother/jdk/jdk1.7.0_25

The bin directory of jdk: /home/codebrother/jdk/jdk1.7.0_25/bin

The lib directory of jdk: /home/codebrother/jdk/jdk1.7.0_25/lib

Edit ~/.bashrc file

command:

vi ~/.bashrc

Add the following variables (Figure 6)

export JAVA_HOME=/home/codebrother/jdk/jdk1.7.0_25export JAVA_BIN=$JAVA_HOME/binexport JAVA_LIB=$JAVA_HOME/libexport CLASSPATH=.:$JAVA_LIB/tools.jar:$JAVA_LIB/dt.jarexport PATH=$JAVA_BIN:$PATH

Press the ESC key, then: wq save and exit

Make jdk environment variables take effect, source ~/.bashrc (Figure 7)

View jdk version

Enter java -version, javac -version (Figure 8)

to sum up

The above is the JDK environment variable configuration method under ubuntu introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!

Recommended Posts

JDK environment variable configuration method under ubuntu
Ubuntu configuration development environment
Ubuntu development environment configuration
Network configuration under Ubuntu
Django&MySQL environment deployment under Ubuntu 14.04
Environment configuration of JDK, mysql and tomcat under Centos7
Method of setting up PHP operating environment under Ubuntu server
Ubuntu environment variables and ADB configuration
Install JDK1.8 original under Ubuntu Kylin
Ubuntu 19.1 installation and configuration Chinese environment
Build the C++ compilation environment under ubuntu
Ubuntu17.04 configuration method to replace domestic sources
Ubuntu install PHP and PHP Nginx configuration method
GPU programming (1): CUDA8.0 environment construction under Ubuntu
Build a python development environment under Ubuntu
DLNA/UPnP Server installation and configuration under Ubuntu 12.04
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
Install JDK and configure environment variables on Ubuntu 16.04
ubuntu 18.04 early configuration
Ubuntu nfs configuration
Kaldi installation and configuration graphic tutorials under Ubuntu
Ubuntu20.04 configuration notes
Ubuntu 14.04 configuration record
Detailed explanation of static DNS configuration method in Ubuntu
Ubuntu16.04 mirror complete installation and configuration tutorial under VMware
Install nvidia graphics driver under Ubuntu (easy installation method)
Detailed explanation of static DNS configuration under Ubuntu system
Resolve the problems encountered in the linux environment under ubuntu
Install node.js under Ubuntu
ubuntu configuration python, Red
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Python MySQLd under Ubuntu
Start working under ubuntu
Ubuntu 18.04 network card configuration
[python] python2 and python3 under ubuntu
Use iptables under ubuntu
2018-09-11 Install arduino under Ubuntu
LNMP installation under Ubuntu
Python virtual environment: Ubuntu16.04
023. Ubuntu common personalized configuration
Ubuntu Touch environment setup
Install JDK10+ on Ubuntu
Install JDK in Ubuntu19.10
Ubuntu18.10 configure Java environment
Install ROS under ROS Ubuntu 18.04[2]
Install MySQL under Ubuntu
Install Yarm-PM2 under Ubuntu
ubuntu environment deployment project
ubuntu14.04 install jdk1.8 tutorial
There is no solution for Chinese input method under ubuntu
Detailed steps for installing Django under Python 3.6 in Ubuntu 16.04 environment
Method steps for installing and configuring SSH service under Ubuntu 18.04