==========ubuntu=============================
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u21-oth-JPR
查看linux系统的位数getconf LONG_BIT
再下载
http://forum.ubuntu.org.cn/viewtopic.php?t=183803
==============redhat=====================
1 我使用yum安装的jdk
http://www.360doc.com/content/15/0504/10/9552892_467829030.shtml
yum -y list java*
yum -y install java-1.6.0-openjdk* #必须root用户
java -version
2 然后使用命令找到的jdk的安装路径
http://blog.csdn.net/killerover84/article/details/51718940
使用到的命令如下:
Java -version
echo $JAVA_HOME
which java
ls -lrt /usr/bin/java
ls -lrt /etc/alternatives/java
cd /usr/lib/jvm
ls
截图如下:
3 然后配置
http://blog.csdn.net/zwhfyy/article/details/8349788
vi 此文件/etc/profile
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
public class H {
public static void main(String [] args) {
System.out.println("hello");
}
}
编辑退出
然后
javac H.java
然后
java H
就可以看到结果了。
=============================================================================