默认是openjdk 1.7. 而hivedb 编译貌似非1.5,不行,报/tmp/hivedb/hivedb-master/src/main/java/org/hivedb/meta/persistence/HiveBasicDataSource.java:[13,7] error: HiveBasicDataSource is not abstract and does not override abstract method getParentLogger() in CommonDataSource
首先确定是64位机器
uname -a
Linux cs-node1 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
下载1.5jdk
开始下了jdk-1_5_0_22-linux-amd64-rpm.bin 别以为是amd的,就是要装这个。jdk-1_5_0_22-linux-i586-rpm.bin 是32位的。
ftp上传linux主机上,chmod 777 后直接执行
./jdk-1_5_0_22-linux-amd64-rpm.bin
出现licience许可,crl+c ,提升yes or no 敲yes。安装
---------------------------
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-1_5_0_22-linux-amd64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Done.
--
安装成功,
查看安装到哪里了
find / -name java
/var/lib/alternatives/java
/root/.m2/repository/net/java
/root/.m2/repository_jw/net/java
/etc/pki/java
/etc/java
/etc/alternatives/java
/opt/continuent/releases/tungsten-enterprise-1.5.3-85_pid17929/tungsten-replicator/samples/extensions/java
/usr/lib/java
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/bin/java
/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java
/usr/lib/jvm/java
/usr/lib/jvm-exports/java
/usr/java
/usr/java/jdk1.5.0_22/jre/bin/java
/usr/java/jdk1.5.0_22/bin/java
/usr/bin/java
/usr/share/java
/tmp/tungsten-enterprise-1.5.3-85/tungsten-replicator/samples/extensions/java
/tmp/hivedb/hivedb-master/src/test/java
/tmp/hivedb/hivedb-master/src/main/java
--
设置环境变量
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.5.0_22
--
增加java 可执行文件选项,---设置默认选项
[root@cs-node1 java]# alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_22/bin/java 60
[root@cs-node1 java]# alternatives --config java
There are 4 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
3 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
4 /usr/java/jdk1.5.0_22/bin/java
Enter to keep the current selection[+], or type selection number: 4
[root@cs-node1 java]# java -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
--
至此,一些程序使用默认的jdk。还是用1.5.如hivedb编译。重新开个ssh窗口,或者clone一个。才能真正使得新安装的jdk生效。
疑问:alternatives --config java 选过了,是不是profile里自动改过来呢? 没试
参考http://www.linuxidc.com/Linux/2012-09/71358.htm,http://johnsz.blog.51cto.com/525379/694052