Submitted On 21-JAN-1998
brynr
Requires native code or 'exec'-ing native programs
Submitted On 31-DEC-1998
AuP
Links, symbolic and hard, should be supported
in java as specified by POSIX. Unix platforms
always support links, and WinNT apparently does
so too: <http://www.mvps.org/win32/ntfs/lnw.html>.
Submitted On 28-JAN-1999
BenForgeau
That should be supported, I want to do something
like the Unix "find" command, and recursing into
links can result in an infinite loop. I think that
a 'File.isLink()' would be sufficient.
Submitted On 23-MAR-1999
VikingJS
The File abstraction in Java is really weak. It is based on the assumption that
the location and name of a file is the file's identity, rather than an attribue
of the file. Many operating systems (eg Mac and I assume Windows) have moved
well beyond that method to specify the identity of a file. What we need is a
class to use instead of java.io.File that _is_ a symbolic link.
Submitted On 18-AUG-2000
ddreams
Here's hoping it comes about soon. I abandoned my own
version of find with java.io.File in favor of 'exec'ing a
Unix version of "find".
Any suggestionions on how to do this in NT? I have no idea
whether NT supports or uses links, my code seems to work on
it but it's going to target a variety of users.
Submitted On 06-JUL-2001
berstis
I find it surprising that Sun would not have fixed this much earlier given that Solaris must exhibit this problem. One
cannot recursively visit the files and disks because there is no way to tell when you are in a loop due to a symbolic
link. Furthermore, the so called "canonical" path name is not canonical (at least on the Linux
implementation of Java).. it just gets longer and longer as you go around the loop! Please fix this ASAP and in
older versions of Java as well!
Submitted On 15-OCT-2001
ramani_ranjan
The work around is as follows. It works for me on AIX.
Assume, there are two files (/opt/a.txt, /opt/b.txt). Here "b.txt" is a symbolic link to "a.txt".
File system listing shows (b.txt -> a.txt).
File f = new File("b.txt");
System.out.println("Canonical : "+f.getCanonicalPath());
System.out.println("Absolute : "+f.getAbsolutePath());
Output :
Canonical : a.txt
Absolute : b.txt
So, when the absolute path is not equal to canonical path, it is a symbolic link. Absolute path is the link
itself and the canonical path is the original file.
If there is a symbolic link (c.txt -> b.txt -> a.txt), then for 'c.txt', absolute path is 'c.txt' and canonical
path is 'a.txt'. So, you can use JNI and issue a "readLink" system call to get 'b.txt' and so on till you reach
'a.txt', which is the end of the link chain.
Submitted On 10-APR-2006
I have tried the approach of comparing a file's absolute path to it's canonical path... but I don't believe it is reliable.
For example, imaging you have /opt/dirA as a symbolic link to /opt/dirB... and that you have a file called 'test.txt' inside this directory.... comparing 'test.txt's absolute path to it's canonical path would lead you to think that test.txt is itself a symbolic file... whereas it isn't...
Absolute Path: /opt/dirA/test.txt
Canonical Path: /opt/dirB/test.txt
Please can we have a proper fix for this issue.
Submitted On 06-JUN-2006
aquila_deus
NTFS reparse point is kind of symbol link (for absolute path only) and it's unknown by all but a few special tools, so if you create it from your program, the users will likely to be confused...
I heard vista is going to have a real, unix-like symbol link support, anyone can confirm this?
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|