先下载了个jdk-6u5-linux-i586-rpm.bin
照着网上说的用root用户执行了
chmod +x jdk-6u5-linux-i586-rpm.bin //所有用户可以执行
sudo ./jdk-6u5-linux-i586-rpm.bin //执行
结果输出:
Sun Microsystems, Inc. Binary Code License Agreement
...
...
...
...
Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u2-linux-i586.rpm
inflating: sun-javadb-common-10.2.2-0.1.i386.rpm
inflating: sun-javadb-core-10.2.2-0.1.i386.rpm
inflating: sun-javadb-client-10.2.2-0.1.i386.rpm
inflating: sun-javadb-demo-10.2.2-0.1.i386.rpm
inflating: sun-javadb-docs-10.2.2-0.1.i386.rpm
inflating: sun-javadb-javadoc-10.2.2-0.1.i386.rpm
error: Failed dependencies:
/bin/basename is needed by jdk-1.6.0_02-fcs.i586
/bin/cat is needed by jdk-1.6.0_02-fcs.i586
/bin/cp is needed by jdk-1.6.0_02-fcs.i586
/bin/gawk is needed by jdk-1.6.0_02-fcs.i586
/bin/grep is needed by jdk-1.6.0_02-fcs.i586
/bin/ln is needed by jdk-1.6.0_02-fcs.i586
/bin/ls is needed by jdk-1.6.0_02-fcs.i586
/bin/mkdir is needed by jdk-1.6.0_02-fcs.i586
/bin/mv is needed by jdk-1.6.0_02-fcs.i586
/bin/pwd is needed by jdk-1.6.0_02-fcs.i586
/bin/rm is needed by jdk-1.6.0_02-fcs.i586
/bin/sed is needed by jdk-1.6.0_02-fcs.i586
/bin/sort is needed by jdk-1.6.0_02-fcs.i586
/bin/touch is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/cut is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/dirname is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/expr is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/find is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/tail is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/tr is needed by jdk-1.6.0_02-fcs.i586
/usr/bin/wc is needed by jdk-1.6.0_02-fcs.i586
/bin/sh is needed by jdk-1.6.0_02-fcs.i586
Installing JavaDB
error: Failed dependencies:
/bin/sh is needed by sun-javadb-core-10.2.2-0.1.i386
Done.
鉴于我是个新新新手看不懂什么意思,只好从网上找了半天,结果发现原来debian和ubuntu一般用.deb安装软件,不用.rpm来安装packages。
那么就需要按照下列步骤来安装了:
1:./jdk-6u5-linux-i586-rpm.bin -x //生成好多个.rpm安装包
2:alien --scripts --keep-version -d *.rpm //把多个.rpm包转化为多个.deb包
3:dpkg -i *.deb //安装多个.deb包
4:删除你认为不重要的文件
然后看了看 /usr 下真的有一个 java目录了,该设置环境变量了:
1:vi /etc/profile //打开 /etc/profile 文件
2:在文件最后写入
JAVA_HOME=/opt/jdk-1.5.0_04
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH