到java.sun.com下载自解压安装包jdk-1_5_0_06-nb-4_1-linux-ml.bin
安装:
[root@RHEL4 JDK-1.5.0.06]# chmod +x jdk-1_5_0_06-nb-4_1-linux-ml.bin
[root@RHEL4 JDK-1.5.0.06]# ./jdk-1_5_0_06-nb-4_1-linux-ml.bin
选择安装位置,
NetBeans安装目录: /opt/netbeans-4.1
J2SDK安装目录: /opt/jdk1.5.0_06
配置Java环境变量:
在 ~/.bash_profile 里加入下列几行环境变量即可:
export JAVA_HOME=/opt/jdk1.5.0_06
export PATH=$PATH:$JAVA_HOME/bin
export MANPATH=$JAVA_HOME/man
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
然后执行下列操作:
mv /usr/bin/java /usr/bin/java.bak
ln -s /opt/jdk1.5.0_06/bin/java /usr/bin/java
注销当前用户,重新登录。
下面验证Java环境变量是否生效:
[root@RHEL4 ~]# echo $JAVA_HOME
/opt/jdk1.5.0_06
[root@RHEL4 ~]# echo $CLASSPATH
.:/opt/jdk1.5.0_06/lib/dt.jar:/opt/jdk1.5.0_06/lib/tools.jar:/opt/jdk1.5.0_06/jre/lib/rt.jar
[root@RHEL4 ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/jdk1.5.0_06/bin:/home/lwg/bin:/opt/jdk1.5.0_06/bin:/opt/jdk1.5.0_06/bin
[root@RHEL4 ~]# java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
[root@RHEL4 ~]#
环境变量设置OK!
下面测试JDK:
[root@RHEL4 temp]# vim test.java
class test{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
保存,退出,然后编译、执行:
[root@RHEL4 temp]javac test.java
[root@RHEL4 temp]java test
Hello World!
好了,JDK工作正常!
如果要使某个用户具有运行java命令的权限,只要修改其bash初始化文件.bashrc或者.bash_profile即可。
-------------------------------------------------------------------------------------------------
修改jre汉字显示
一、复制Windows系统的simhei.ttf字体成为Linux下的/opt/jdk1.5.0_06/jre/lib/fonts/simsun.ttf:
[root@localhost lwg]# cp disk/WINDOWS/Fonts/simhei.ttf /opt/jdk1.5.0_06/jre/lib/fonts/simsun.ttf
二、切换目录:
[root@localhost lwg]# cd /opt/jdk1.5.0_06/jre/lib/
三、修改 fonts/font.dir
[root@localhost lib]# cp fonts/fonts.dir fonts/fonts.dir.backup
[root@localhost lib]# vim fonts/fonts.dir
1)把第一行数字加1。
2)在第二行加上
simsun.ttf -SungtiL GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
四、移动所有fontconfig... 文件:
[root@localhost lib]# mkdir fontconf.backup
[root@localhost lib]# mv fontconfig.* fontconf.backup/
五、复制 fontconfig.RedHat.properties.src 为 fontconfig.RedHat.properties
[root@localhost lib]# cp fontconf.backup/fontconfig.RedHat.properties.src fontconfig.RedHat.properties
六、修改 fontconfig.RedHat.properties
1) 把
# Component Font Mappings
allfonts.chinese-cn-iso10646=-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1
修改为:
# Component Font Mappings
allfonts.chinese-cn-iso10646=-SungtiL GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
2) 把
# Search Sequences
sequence.allfonts=latin-1
修改为:
# Search Sequences
sequence.allfonts=zh-1
七、汉字显示测试:
[root@localhost lib]# ../bin/ControlPanel
阅读(1936) | 评论(0) | 转发(0) |