引用官网的一句话,”The JDK is a development environment for building applications, applets, and components using the Java programming language.”哦,原来JDK是一个开发环境。
第一步:下载jdk-6u26-linux-i586.bin
http://download.Oracle.com/otn-pub/java/jdk/6u26-b03/jdk-6u26-linux-i586.bin
第二步:解压安装
#cp ./jdk-6u26-linux-i586.bin /usr/local/lib
#cd /usr/local/lib
#chmod +x jdk-6u26-linux-i586.bin
#./jdk-6u26-linux-i586.bin
第三步:修改环境变量
#vim ~/.bashrc
添加:
export JAVA_HOME=/usr/local/lib/jdk.6.0_26
export JRE_HOME=/usr/local/lib/jdk.6.0_26/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=/usr/local/lib/jdk1.6.0_26/bin:$PATH
第四步:测试
#java -version
java version “1.6.0_26”
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
class FirstProgram
{
public static void main(String [] arguments)
{
System.out.println(“First java program.“);
}
}
OK~~不知道这样会不会有问题,先这样吧。