|
1.下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk6downloads-1902814.html
2.上传到linux下
- [root@localhost ~]# rz
- rz waiting to receive.
- Starting zmodem transfer. Press Ctrl+C to cancel.
- Transferring jdk-6u29-linux-i586-rpm.bin...
- 100% 78780 KB 3751 KB/s 00:00:21 0 Errors
3.赋予执行权限
- [root@localhost ~]# chmod +x jdk-6u29-linux-i586-rpm.bin
4.安装
- [root@localhost ~]# ./jdk-6u29-linux-i586-rpm.bin
- Unpacking...
- Checksumming...
- Extracting...
- UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
- inflating: jdk-6u29-linux-i586.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.
5.验证安装是否成功(好吧,显示还是系统自带的jdk,有些软件识别不到系统的,所有有时自己安装还是很有必要的)
- [root@localhost ~]# java -version
- java version "1.4.2"
- gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)
-
- 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.
6.配置环境变量
系统默认把jdk安装到 /usr/java/jdk1.6.0_29 目录下(找了N次,还是没找到如何把jdk安装到自己指定的目录下)
- [root@localhost ~]# vi /etc/profile
在文件的末尾添加
- #set Java Environment
- export JAVA_HOME=/usr/java/jdk1.6.0_29
- export PATH=$JAVA_HOME/bin:$PATH
- export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
执行命令(立即生效命令,否则重启后生效)
- [root@localhost ~]# source /etc/profile
检验成功与否
- [root@localhost ~]# java -version
- java version "1.6.0_29"
- Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
- Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode, sharing)
|
|
|