1. install and configure JDK environment variables in centos 5.6

Source: Internet
Author: User

I. Preparations

Centos System (liunx ).

JDK installation package: jdk-6u27-linux-i586.bin

MySQL package: MySQL-5.1.72-1.glibc23.i386.rpm-bundle.tar

 

 

 

Ii. JDK Installation

 

Upload the JDK installation package: jdk-6u27-linux-i586.bin to/usr/local/Java at 192.168.1.190.

 

1: Installation

Create the installation directory, create the installation path under/usr/local/Java, and test the file to this path:
# Mkdir/usr/local/Java

Jdk-6u27-linux-i586.bin

This is a self-decompressed file. It is installed on Linux as follows:
# Chmod 755 jdk-6u27-linux-i586.bin (note -- grant permissions)
#./Jdk-6u27-linux-i586.bin (note that this step must be in the directory where the jdk-6u11-linux-i586.bin is located)
After entering YES as prompted, JDK is decompressed.

A line appears: Do you aggree to the above license terms? [Yes or No]
The installer asks if you are willing to comply with the license agreement you just saw. Of course you have to agree. Enter "y" or "yes" and press Enter.

 

2: view the file.

# Cd/usr/local/Java

# Ls

Iii. Configure environment variables in JDK

 

# Vi/etc/profile

Add the following content to it:

Export java_home =/usr/local/Java/jdk1.6.0 _ 27

Export java_bin =/usr/local/Java/jdk1.6.0 _ 27/bin

Export Path = $ path: $ java_home/bin

Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar

Export java_home java_bin path classpath

 

To make the/etc/profile file take effect immediately after modification, run the following command:
#./Etc/profile

Note: There are spaces between. and/etc/profile.

Open the doc window
Enter the following command. (The Core Command is as follows)

[[Email protected] ~] # Ls

[[Email protected] ~] # Env

[[Email protected] etc] # vi Profile

[[Email protected] etc] # ll Profile

-RW-r -- 1 Root 1014 Aug 29 18:11 Profile

[[Email protected] etc] # chmod U + x Profile

[[Email protected] etc] # ls-l Profile

-Rwxr -- r -- 1 Root 1014 Aug 29 18:11 Profile

[[Email protected] etc] # vi Profile

[[Email protected] etc] # cd/usr/local/

Bin/etc/games/include/IVR/Java/lib/libexec/mbox/prompt/sbin/share/src/

[[Email protected] etc] # cd/usr/local/Java/JDK

Jdk1.6.0 _ 27/jdk-6u27-linux-i586.bin

[[Email protected] etc] # cd/usr/local/Java/JDK

Jdk1.6.0 _ 27/jdk-6u27-linux-i586.bin

[[Email protected] etc] # cd/usr/local/Java/jdk1.6.0 _ 27/

[[Email protected] jdk1.6.0 _ 27] # pwd

/Usr/local/Java/jdk1.6.0 _ 27

[[Email protected] jdk1.6.0 _ 27] # vi/etc/profile

 

#/Etc/profile

If [-z "$ inputrc"-! -F "$ home/. inputrc"]; then

Inputrc =/etc/inputrc

Fi

Export java_home =/usr/local/Java/jdk1.6.0 _ 27

Export java_bin =/usr/local/Java/jdk1.6.0 _ 27/bin

Export Path = $ path: $ java_home/bin

Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar

Export java_home java_bin path classpath

Export path user LOGNAME mail hostname histsize inputrc

 

For I in/etc/profile. d/*. Sh; do

 

"/Etc/profile" 62l, 1246c written

[[Email protected] jdk1.6.0 _ 27] # source/etc/profile

[[Email protected] jdk1.6.0 _ 27] # Java-version

Java version "1.6.0 _ 27"

Java (TM) se Runtime Environment (build 1.6.0 _ 27-b07)

Java hotspot (TM) server VM (build phases 2-b06, mixed mode)

[[Email protected] jdk1.6.0 _ 27] # ls-L/etc/profile

-Rwxr -- r -- 1 Root 1246 Sep 1/etc/profile

[[Email protected] jdk1.6.0 _ 27] #

 

 

 

 

Specific operations:

 

3. Modify the profile file
# ETC/usr/Profile
Export java_home =/usr/local/Java/jdk1.6.0 _ 27
Export java_bin =/usr/local/Java/jdk1.6.0 _ 27/bin
Export Path = $ path: $ java_home/bin
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export java_home java_bin path classpath

4. Exit and save the modified profile file under VI.
Press ESC and enter RQ.

Appears
E212 "can not open file for writing
Press ENTER or type command to continue

1. install and configure JDK environment variables in centos 5.6

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.