lastModified()  方法肯定是不灵的用那个Runtime.getRuntime().exec()方法具体怎么做啊

解决方案 »

  1.   

    用File类难道没有取最后修改时间的方法或者属性之类的,肯定有,看看javaapi中的File类。
      

  2.   

    好像是没有取得创建时间的API
      

  3.   

    hehe 
    好奇怪的问题你可以在FILE NEW 的前或者后取SYSTEM current time 就可以算是了如果你想算精确的时间
    可以取前后的时间差
      

  4.   

    import java.io.*; 
    public class Test { 
    public static void main(String[] args) { 
    try { 
    Process p = Runtime.getRuntime().exec("cmd /C dir c:\\temp\\xx.txt /tc"); 
    InputStream is = p.getInputStream(); 
    int i; 
    while((i=is.read())!=-1) System.out.print((char)i); 
    } catch (java.io.IOException exc) { exc.printStackTrace(); } 


      

  5.   

    ps:以上方法在windows下可以这样取
      

  6.   

    现在给出一个能取到具体时间的程序:
    代码如下:
    /*
     * FirstTest.java
     *
     * Created on 2006年7月12日, 下午3:25
     *
     * To change this template, choose Tools | Template Manager
     * and open the template in the editor.
     */package firstnetbeanspro;
    import java.io.*;
    /**
     *
     * @author xiaotang
     */
    public class FirstTest {
        
        /** Creates a new instance of FirstTest */
        public FirstTest() {
        }
        
        public static void main(String[] args) {
            try { 
                Process p = Runtime.getRuntime().exec("cmd /C dir c:\\reponse.log /tc"); 
                InputStream is = p.getInputStream(); 
                BufferedReader br = new BufferedReader(new InputStreamReader(is));
                StringBuffer sb = new StringBuffer();
                String str;
                int i=0;
                while((str = br.readLine()) != null){
                    i++;
                    if(i == 6){
                        System.out.println(str.substring(0,17));
                    }                
                }
                
        } catch (java.io.IOException exc) { 
            exc.printStackTrace();
        } 

        }
      

  7.   

    楼主这个号bbwls() 是OnlyFor_love的小号  你要给分的话全部给OnlyFor_love吧  拜托了