To install JDK, first uninstall the default JDK 1.42.
Rpm-Qa | grep gcj release confirm the gcj version number
Libgcj-devel-3.4.6-3
Java-1.4.2-gcj-compat-1.4.2.0-27jpp uninstall gcj Based on version number
Libgcj-3.4.6-3
# Yum-y remove java-1.4.2-gcj-compat
Then install JDK 1.6
1. Download JDK
Download it by yourself, do not write the step; I downloaded the jdk-1.6.0_01-linux-i586.bin
Ii. Installation
(1) create a Java folder under USR
# Mkdir/usr/Java
(2) I used winscp to put the JDK file under the/usr/Java folder.
Run the following command:
# Cd/usr/Java
# Chmod A + x jdk-1.6.0_01-linux-i586.bin
Give the current user permission to execute the jdk-1.6.0_01-linux-i586.bin;
(3) install
#./Jdk-1.6.0_01-linux-i586.bin
Run the jdk-1.6.0_01-linux-i586.bin, it will show the JDK installation license agreement, press the space to flip the page, the program will finally ask if you agree to the above agreement, of course, agree, enter "yes" and decompress JDK to the current directory. The decompression progress is displayed on the screen.
After decompression, a directory named "jdk1.6.0 _ 26" will be created under the/usr/Java directory. Now we have installed JDK under centos.
Iii. Configuration
In theory, JDK can be used normally after it is installed, but we need to set it for future convenience. As with JDK settings in windows, we usually need to set environment variables.
I am used to modifying/etc/profile to add environment variables. The environment variables set in/etc/profile are like the system variables in Windows environment variables, which can be used by all users.
Open/etc/profile in a text editor
# Vi/etc/profile
Add the following lines at the end:
Export java_home =/usr/Java/jdk1.6.0 _ 26
Export classpath =.: $ java_home/JRE/lib/RT. jar: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export Path = $ path: $ java_home/bin
In this way, we have set JDK, and the source/etc/profile under centos will take effect.
Iv. delete/uninstall
Run the # rm-fr jdk-1.6 command to delete JDK. Don't forget to clear the configuration file.
Install centos 5 Linux eclipse
(1) first download eclipse-sdk-3.3.2-linux-gtk.tar.gz to the OPT directory;
(2) solve the pressure on eclipse;
(3) Add the following content to VI/usr/local/eclipse. sh:
#! /Bin/bash
#
#
Export java_home =/usr/Java/jdk1.6.0 _ 26
Export classpath =/usr/Java/jdk1.6.0 _ 26/lib
/Opt/Eclipse/eclipse-VM/usr/Java/jdk1.6.0 _ 26/bin/Java
(4)./usr/local/eclipse. Sh or create a starter to start Elipse