Linux System Java Environment configuration

Source: Internet
Author: User

1. Uninstall the JDK that comes with the Linux system

Java-version

Rpm-qa | Grep-i Java

We're going to delete our own JDK environment.

RPM-E--nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.i686
RPM-E--nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686

Query again whether it has been deleted

2. Install the JDK you downloaded

2.1 Download JDK, Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Using a 32-bit Linux system, so download 32-bit, you can use the command query is 32-bit or 64-bit

Getconf Long_bit

2.2 Upload the JDK to the server and unzip it to the directory you created.

Mkdir-p/usr/local/java

Unzip the JDK below/usr/local/java

TAR-ZXVF jdk-8u171-linux-i586.tar.gz-c/usr/local/java/
cd/usr/local/java/jdk1.8.0_171/

3. Configure Environment variables

3.1 Editing the Linux environment variable file

Vim/etc/profile

Press I to insert

3.2 Adding a Java Variable environment

#java configjava_home=/usr/local/java/jdk1.8.0_171classpath=.: $JAVA _home/lib/tools.jarpath= $JAVA _home/bin:$ Pathexport java_home CLASSPATH PATH

Press ESC to exit edit mode, enter: Wq save

3.3 Save the variable file, reload the variable

The input Java command will prompt

Reload environment variable configuration file

Source/etc/profile

4. Test whether the installation is successful

Executive Java,javac

Java Configuration Complete

Linux System Java Environment configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.