Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2484196
  • 博文数量: 609
  • 博客积分: 10061
  • 博客等级: 上将
  • 技术积分: 5920
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-25 08:30
文章分类

全部博文(609)

文章存档

2010年(13)

2009年(39)

2008年(558)

我的朋友

分类: Java

2008-09-12 20:30:59

Install Java SE Development Kit (JDK).
 
[1]    Go Sun download site and Click and next, select "linux", then you can download JDK. Next, upload it on your server by FTP and so on.
 

[2]    Install JDK

[root@www ~]# chmod 700 jdk-6u10-rc2-bin-b31-linux-i586-05_sep_2008-rpm.bin

[root@www ~]# ./jdk-6u10-rc2-bin-b31-linux-i586-05_sep_2008-rpm.bin
 
##### read terms of use #####
 
Do you agree to the above license terms? [yes or no]
yes
# accept
 
###################################
 
For more information on what data Registration collects and
how it is managed and used, see:

 
Press Enter to continue.....
 
Done.


[3]    Make test program and verify working.

[root@www ~]# vi day.java
 
import java.util.Calendar;
 
class day {
   public static void main(String[] args) {
       Calendar cal = Calendar.getInstance();
       int year = cal.get(Calendar.YEAR);
       int month = cal.get(Calendar.MONTH) + 1;
       int day = cal.get(Calendar.DATE);
       int hour = cal.get(Calendar.HOUR_OF_DAY);
       int minute = cal.get(Calendar.MINUTE);
       System.out.println(year + "/" + month + "/" + day + " " + hour + ":" + minute);
   }
}
 
[root@www ~]# javac day.java # compile

[root@www ~]# java day # run
2008/8/24 21:34
 
阅读(1480) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~