You can't really do it from pure Java. The file format is undocumented. People have reverse engineered parts of it, but I believe (and my memory may be wrong) that you can't really use the information therein from Java; you need to make Win32 calls -- i.e., JNI, Java native methods -- to use it.
The bloody JFileChooser didn't even support shortcuts until Tiger!
As Ernest pointed out, this seems specific to the operating system.
I did some experimenting with a folder alias on my Mac, and couldn't find a way in Java to get much out of it. (Represented as a File object, the alias appears to be a file rather than a directory, but the length is zero.)
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Dec 14, 2004
For clearing alot of thoughts, i had be scanning the API to find a suitable method. anyways that gives me my answer.
SUN should provide a method that returns the Target location of a file object.Which means that in case where its a directory it just provides the absolute path ot it and in case its a shortcut it provides an absolute path to the location of the dir. Just a thought.
In Linux these are called links, although there are two different kinds: hard links and symbolic links. Since all files have at least one hard link, they don'g cause any problems. A symbolic link to a directory behaves exactly the same as an actual directory as far as the File class is concerned. I'm not sure about symbolic links to other types of files, but I think they behave the same as well. Most likely this has nothing to do with Java or the File class but is handled at the OS level in such a way that File is quite seamless. Unfortunately, not all operating systems are smart enough to handle files so well.