How to discover a File's creation time with Java?

后端 未结 7 1183
遥遥无期
遥遥无期 2020-11-28 10:59

Is there an easy way to discover a File\'s creation time with Java? The File class only has a method to get the \"last modified\" time. According to some resources I found

7条回答
  •  盖世英雄少女心
    2020-11-28 11:09

    I've been investigating this myself, but I need something that will work across Windows/*nix platforms.

    One SO post includes some links to Posix JNI implementations.

    • JNA-POSIX
    • POSIX for Java

    In particular, JNA-POSIX implements methods for getting file stats with implementations for Windows, BSD, Solaris, Linux and OSX.

    All in all it looks very promising, so I'll be trying it out on my own project very soon.

提交回复
热议问题