linux安装搭建java环境

今天尝试在linux上安装搭建java环境,记录下


1、下载JDK jdk-6u38-linux-x64-rpm.bin

http://www.oracle.com/technetwork/java/javase/downloads/index.html


2、在root用户进行安装



[root@hcn10g ~]# cp jdk-6u38-linux-x64-rpm.bin /usr/java
[root@hcn10g ~]# ls
anaconda-ks.cfg  install.log         jdk-6u38-linux-x64-rpm.bin
Desktop          install.log.syslog
[root@hcn10g ~]# 
[root@hcn10g ~]# 
[root@hcn10g ~]# chmod u+x jdk-6u38-linux-x64-rpm.bin 
[root@hcn10g ~]# 
[root@hcn10g ~]# 
[root@hcn10g ~]# ./jdk-6u38-linux-x64-rpm.bin 
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u38-linux-amd64.rpm  
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm  
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm  
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm  
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm  
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm  
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm  
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
Installing JavaDB
Preparing...                ########################################### [100%]
   1:sun-javadb-common      ########################################### [ 17%]
   2:sun-javadb-core        ########################################### [ 33%]
   3:sun-javadb-client      ########################################### [ 50%]
   4:sun-javadb-demo        ########################################### [ 67%]
   5:sun-javadb-docs        ########################################### [ 83%]
   6:sun-javadb-javadoc     ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and 
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue..... 
Done.
[root@hcn10g ~]# 

3、配置环境变量

在/etc/profile文件中配置

export JAVA_HOME=/usr/java/jdk1.6.0_38
export JRE_HOME=/usr/java/jdk1.6.0_38
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

保存/etc/profile后,执行source /etc/profile命令

执行java -version

[root@hcn10g ~]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-51)


Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@hcn10g ~]# 


这里好像也还是有点问题,java的version还是1.4.2


解决方法:

[root@hcn10g bin]# ln -s -f /usr/java/jdk1.6.0_38/jre/bin/java

[root@hcn10g bin]# ls -s -f /usr/java/jdk1.6.0_38/bin/javac


[root@hcn10g bin]# java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
[root@hcn10g bin]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值