Linux installation JDK and configuration environment variables

Source: Internet
Author: User

Jdk:

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

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/53/9C/wKiom1RsOyeDIfL2AAIWAd0YY3o476.jpg "title=" Screenshot2442.jpg "alt=" Wkiom1rsoyedifl2aaiwad0yy3o476.jpg "/>


Select 64-bit or 32-bit downloads based on the Linux system version, and the official version is available in RPM and tar.gz two versions.


Installation:

[Email protected] cdrom]# RPM-IVH jdk-8u25-linux-x64.rpm


Configuring the JDK environment variables

Method One: Set the variable under the shell (this method is only valid for the current shell, and will need to be reconfigured if you open another shell)

Export java_home=/usr/java/jdk1.7.0_40/
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

(where only export Path=/usr/java/jdk1.7.0_40/bin is configured: $PATH can)

Method Two: Modify the/etc/profile file (this method once and for all, set once, valid for all users)

Open the/etc/profile file with the Vim editor and add the definition of the environment variable at the end of the file

java_home=/usr/java/jdk1.8.0_25/

Path= $JAVA _home/bin: $PATH

Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home
Export PATH
Export CLASSPATH

Save exit, view Java version

[Email protected] cdrom]# java-version

Java Version "1.8.0_25"

Java (TM) SE Runtime Environment (build 1.8.0_25-b17)

Java HotSpot (TM) 64-bit Server VM (build 25.25-b02, Mixed mode)

Indicates successful installation

Method Three: Modify the ~/.BASHRC file (this method is only valid for the current user and is valid for all shells of the user)

Open the ~/.BASHRC file with the VIM editor

Add the definition of the JDK environment variable at the end of the file

Set java_home=/usr/java/jdk1.8.0_25/

Export Java_home

Set path= $JAVA _home/bin: $PATH

Export PATH

Set classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export CLASSPATH

Linux installation JDK and configuration environment variables

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.