1、下载JDK:jdk-6u24-linux-i586-rpm.bin
,过程不表
2、安装:
把下载到桌面的jdk-6u24-linux-i586-rpm.bin 复制到/usr/local/jdk1.6,其中jdk1.6目录默认是没有的,需要自己建立
[root@localhost ~]# pwd
/root
[root@localhost ~]# ls
anaconda-ks.cfg Desktop install.log install.log.syslog
[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# ls
jdk-6u24-linux-i586-rpm.bin
[root@localhost Desktop]# cp jdk-6u24-linux-i586-rpm.bin /usr/local/jdk1.6
[root@localhost Desktop]# cd /usr/local/jdk1.6
[root@localhost jdk1.6]# ls
jdk-6u24-linux-i586-rpm.bin
赋予可执行权限
[root@localhost jdk1.6]# chmod a+x jdk-6u24-linux-i586-rpm.bin
解压
[root@localhost jdk1.6]# ./jdk-6u24-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP ().
inflating: jdk-6u24-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:
Press Enter to continue.....
Done.
ok,安装完毕
3、配置
# vi /etc/profile
在最后加入以下几行:
export JAVA_HOME=/usr/local/java/jdk1.6.0_18
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
用reboot命令重启
4、测试
新建目录javasrc,
创建源文件jahelloworld.java,
public class helloworld{
public static void main(String[] args){
System.out.println("Hello,Welcome to Linux World!");
}
}
[root@localhost javasrc]# javac helloworld.java
[root@localhost javasrc]# java helloworld
hello,world.
ok,成功.
阅读(845) | 评论(0) | 转发(0) |