Linux Installation configuration Java Environment Tutorial

Source: Internet
Author: User

Objective:

This tutorial is based on JDK 1.8, but this tutorial is for versions such as jdk1.7.

Tutorial Body: 1.1. Login to Oracle website Download jdk1.8 installation package (GZ end)

Here you can use "wget +" to implement the download.

  Q: do I need a cookie to download the JDK?

A : students are advised to click the download directly in the browser and then copy the download link in the download task. )

1.2. Extract the installation package to the specified directory (e.g./usr/local/soft/)
Tar  -XZVF  JDK installation package
1.3. Configure the environment variables.

( add the path to the JDK and JRE in/etc/profile and add to path)

1.3.1. Open File/etc/profile:

Vim/etc/profile

1.3.2. Add the following:

( please fill in your actual JDK path, the following example of the JDK path is the/USR/LOCAL/SOFT/JDK folder name )

Export JAVA_HOME=/USR/LOCAL/SOFT/JDK folder name Export JRE_HOME=/USR/LOCAL/SOFT/JDK folder name/jreexport path= $PATH: $JAVA _home/ Bin: $JRE _home/bin

1.3.3. Press ESC, enter: Wq Save to exit.

1.4. Adding Java to the bin

( please fill in your actual JDK path, the following example of the JDK path is the/USR/LOCAL/SOFT/JDK folder name )

Update-alternatives--install/usr/bin/java java/usr/lcoal/soft/jdk folder name 300
1.5. Add Javac to Bin

( please fill in your actual javac path, the following example of the JDK path is the/USR/LOCAL/SOFT/JDK folder name/bin/javac)

Update-alternatives--install/usr/bin/javac javac/usr/lcoal/soft/jdk folder name/bin/javac 300
This blog address:http://www.cnblogs.com/toulanboy/ 1.6. Select the JDK version

( recommended, as it is possible to store multiple JDK versions on the current machine )

1.6.1. Enter the following command

Update-alternatives--config Java

1.6.2. Enter a number to select the version we are installing.

1.7. Refresh the system environment variables
Source/etc/profile
1.8. Verification

(normal output is correct)

Java-versionjavajavac

This blog address:http://www.cnblogs.com/toulanboy/ Reference: "Kafka Introduction and Practice"

Linux Installation configuration Java Environment Tutorial

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.