Installing Java on Linux systems

Source: Internet
Author: User


How to install Java (JRE or JDK) on Ubuntu server, pay attention to the following points: (also applicable on centos,redhat)


1. Download the Java version you want to compress the package.

JRE Download:http://java.com/en/download/manual.jsp; (General direct download JDK)

JDK Download:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html


2. Assuming that the JDK is downloaded, copy the JDK's compressed package jdk-8u131-linux-x64.tar.gz to/USR/LIB/JVM, and if it does not, it will be created automatically:

CP JDK-8U131-LINUX-X64.TAR.GZ/USR/LIB/JVM

Switch to/USR/LIB/JVM and unzip the directory:

Cd/usr/lib/jvmtar XF jdk-8u131-linux-x64.tar.gz

3. Modify the Environment variables:


#vim ~/.BASHRC

#加入以下内容 (no need for # # in VIM)

#export java_home=/usr/lib/jvm/jdk1.8.0_131
#export Classpath=.:${java_home}/lib:${jre_home}/lib
#export Path=${java_home}/bin: $PATH

#保存后使之生效
#source ~/.BASHRC



4. Configure the default program


#update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.8.0_131/bin/java 50
# update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.8.0_131/bin/javac 50
# update-alternatives--config Java



#如果你的系统中安装了其他的jdk, the system will be prompted, select jdk1.8.0_131 can

Note: If you are installing a JRE, just configure the first one above, that is: Java

5. Test whether the installation is complete


#java-version
Java Version "1.8.0_131"
Java (TM) SE Runtime Environment (build 1.8.0_131-B11)
Java HotSpot (TM) 64-bit Server VM (build 25.131-b11, Mixed mode)

If the correct version information appears, such as Java version jdk1.7.0_17, the installation is complete;

If the following results occur, there is a problem with the installed version, such as a 32-bit Java installation on a 64-bit system

-bash:/usr/bin/java:no such file or directory

The problem can be resolved by the following command:

sudo apt-get install libc6-i386

When you use the Java-version command again, the correct version information appears.


Now that the Java environment is fully configured, you can happily write Java programs.


This article is from the "xinsz08の parallel space-time" blog, be sure to keep this source http://xinsz08.blog.51cto.com/10565212/1941629

Installing Java on Linux systems

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.