Installation of Java JDK 8 and configuration of environment variables (Linux and Windows)

Source: Internet
Author: User
Tags java jdk 8

Installation of Java JDK 8 and configuration of environment variables (Linux and Windows)

JDK (Java Development Kit) includes a Java compiler, which can be downloaded here:

Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

After opening the webpage, click "Accept License Agreement ".

Select a version based on the operating system.

Install Java JDK 8 in Windows 8.1 and configure Environment Variables

In Windows, double-click the installation button.

Configuration of JDK 7 environment variables in Win8.1:

Click Computer, select Properties, select Advanced systems settings, and select Environment Variables ).


Create three environment variables (PATH, CLASSPATH, JAVA_HOME.
Add values to three environment variables (determined by the Java path and modified according to the actual situation), for example:

Path d: \ Program Files \ Java \ jdk1.8.0 \ bin; D: \ Program Files \ Java \ jdk1.8.0 \ jre \ bin
Classpath d: \ Program Files \ Java \ jdk1.8.0 \ lib; D: \ Program Files \ Java \ jdk1.8.0 \ lib \ tools. jar
JAVA_HOME D: \ Program Files \ Java \ jdk1.8.0

Different paths are separated by semicolons.

If it is correctly added, after logging out or restarting the computer, enter the following in PowerShell or cmd:

Java-version

Javac-version

The corresponding version information is displayed.


Install Java JDK 8 in Linux and configure Environment Variables

1. Download. Based on the linuxsystem's number of locations, here we use the extension .tar.gz as an example. The direct installation of. rpm is.

2. decompress the package.

3. Put the decompressed folder under/usr/local. (This can be used in any directory)

4. Find the hidden file. profile in the main directory. If there is no. profile, find the file. bash_profile (note that the file name starts with a dot because it is a hidden file ).

5. Add the environment variables to the file. profile or. bash_profile, and add the following four lines at the end of the file (you need to modify them according to the actual situation, which is determined by the JAVA directory ):

Export JAVA_HOME =/usr/local/jdk1.8.0

Export JRE_HOME =$ {JAVA_HOME}/jre

Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib

Export PATH =$ {JAVA_HOME}/bin: $ PATH


If it is correctly added, after logging out or restarting the computer, enter:

Java-version

Javac-version

The version information is displayed.


Be sure to match the number of digits (bit, 64 bit or 32 bit) of your operating system. Otherwise, an error will occur !!!!

Related Article

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.