We talk about java 1.6 here. Since symoblic link is not yet supported, how can examine the existence of them.
1: tell wheather the link file itself exists (return tr
#2 is easy: just use File.isFile
etc., which will traverse the link. The hard part is #1.
So if you cannot use java.nio.file
, and want to avoid JNI etc., the only thing I found which works:
static boolean exists(File link) {
File[] kids = link.getParentFile().listFiles();
return kids != null && Arrays.asList(kids).contains(link);
}
Not terribly efficient but straightforward.