linux安装jdk (当前环境Debian)

由于测试机系统是 Debian x86_64 GNU/Linux   64位系统
故jdk版本也必须是64位----  jdk-6u27-linux-x64.bin
# cd /data/postmall
# chmod u+x jdk-6u27-linux-x64.bin
# ./jdk-6u27-linux-x64.bin
# cp -r /data/postmall/jdk1.6.0_27  /usr/local/jdk     复制之后,可以把/data/postmall/下的jdk目录和.bin文件删除,然后在系统初始化脚本中设置java环境变量,
# vi /etc/profile
在umask 022下面添加以下设置内容:
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
export PATH=$PATH:/usr/local/jdk/bin
export CLASSPATH=./:/usr/local/jdk/lib:/usr/local/jdk/jre/lib
保存,退出!
shell> source /etc/profile    #使之立即生效
【建议也设置默认启动】
# vi /etc/rc.local
加上:
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:/usr/local/jdk/lib:/usr/local/jdk/jre/lib:$CLASSPATH
export JRE_HOME=/usr/local/jdk/jre
保存,退出!

退出终端,重启登陆,然后 # java -version 如果有java版本号出来表示成功。


之前在debian上安装jdk一直报错:

root@debian-han:/home/jinzhu/jdk# rpm -ivh jre-7u6-linux-x64.rpm 
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
error: Failed dependencies:
	/bin/basename is needed by jre-1.7.0_06-fcs.x86_64
	/bin/cat is needed by jre-1.7.0_06-fcs.x86_64
	/bin/cp is needed by jre-1.7.0_06-fcs.x86_64
	/bin/gawk is needed by jre-1.7.0_06-fcs.x86_64
	/bin/grep is needed by jre-1.7.0_06-fcs.x86_64
	/bin/ln is needed by jre-1.7.0_06-fcs.x86_64
	/bin/ls is needed by jre-1.7.0_06-fcs.x86_64
	/bin/mkdir is needed by jre-1.7.0_06-fcs.x86_64
	/bin/mv is needed by jre-1.7.0_06-fcs.x86_64
	/bin/pwd is needed by jre-1.7.0_06-fcs.x86_64
	/bin/rm is needed by jre-1.7.0_06-fcs.x86_64
	/bin/sed is needed by jre-1.7.0_06-fcs.x86_64
	/bin/sort is needed by jre-1.7.0_06-fcs.x86_64
	/bin/touch is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/cut is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/dirname is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/expr is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/find is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/tail is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/tr is needed by jre-1.7.0_06-fcs.x86_64
	/usr/bin/wc is needed by jre-1.7.0_06-fcs.x86_64
	/bin/sh is needed by jre-1.7.0_06-fcs.x86_64


阅读更多
换一批

没有更多推荐了,返回首页