个人认为函数没有,不过倒是有个办法:
使用Process调用cmd /c dir file,然后取得返回的信息,在此信息里做手脚得到文件创建日期。

解决方案 »

  1.   

    没有得到创建时间得函数,只有得到最近一次修改时间得函数,
    lastModified()
      

  2.   

    代码如下:
    import java.lang.*;
    import java.io.*;
    import java.util.*;class GetFileCreatDate 
    {
    public static void main(String[] args) 
    {
    String file = "GetFileCreatDate.class";
    try{
    Process process = Runtime.getRuntime().exec("cmd /c dir " + file);

    InputStream os = process.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(os)); String s = br.readLine();
    while (s != null )
    {
    //System.out.println(s);
    if (s.endsWith(file))
    {
    System.out.println(s.substring(0,10));
    }
    s = br.readLine();
    }
    }catch(Exception e){e.printStackTrace();}
    }
    }
      

  3.   

    java.text.DateFormat df = java.text.DateFormat.getDateTimeInstance(java.text.DateFormat.LONG, java.text.DateFormat.SHORT);out.print(df.format(new Date(file[i].lastModified())))文件的最后修改时间
      

  4.   

    我上面的方法可以用在win2000、xp上,如果是98等,相应代码要修改,例如.cmd.exe换成command.exe等。