Java 1.6 - determine symbolic links
The technique used in Apache Commons uses the canonical path to the parent directory, not the file itself. I don't think that you can guarantee that a mismatch is due to a symbolic link, but it's a good indication that the file needs special treatment.
This is Apache code (subject to their license), modified for compactness.
public static boolean isSymlink(File file) throws IOException {
if (file == null)
throw new NullPointerException("File must not be null");
File canon;
if (file.getParent() == null) {
canon = file;
} else {
File canonDir = file.getParentFile().getCanonicalFile();
canon = new File(canonDir, file.getName());
}
return !canon.getCanonicalFile().equals(canon.getAbsoluteFile());
}
Detecting a symlink in Java
Also you can use isSymbolicLink(Path path) method. It will be more reliable.
java.io.File file = ...;
boolean isSymbolicLink = Files.isSymbolicLink(file.toPath());
Similar examples from Java Doc 'Detecting a Symbolic Link'.
Java: check symbolic link file existence
looks that way for now... unless you go with openjdk http://openjdk.java.net/projects/nio/javadoc/java/nio/file/attribute/BasicFileAttributes.html#isSymbolicLink()
Detect if a File is a symbolic link in Java 8
Take a look at java.nio.file.attribute.BasicFileAttributes.isSymbolicLink()
available since Java 7
How to get java to recognize symbolic links under cygwin
I don't think there is a simple answer to this. As various pages state, Cygwin is an application suite rather than an OS, and Sun does not support Java on Cygwin.
However, it may be possible to build JDK 6 for Cygwin from the source code. Certainly, this page implies that it is possible. Whether this gives you a JDK that understands Cygwin style symbolic links is anyones guess ... :-)
spring-integration-file using java 1.6
This is a bug; the watch service used to be an optional (external) class; it was embedded as an inner class in 4.3 to avoid some configuration issues. A work-around is to drop back to the 4.2.12 version. I opened a JIRA Issue.
Related Topics
Transitive Dependencies Not Resolved for Aar Library Using Gradle
What Is Shareduserid in Android, and How Is It Used
Detect Touch Press VS Long Press VS Movement
Javafx Freeze on Desktop.Open(File), Desktop.Browse(Uri)
How to Get Rjava 0.9-3 to Work on Os X 10.7.4 with Oracle Java 1.7
Why Does Priorityqueue.Tostring Return the Wrong Element Order
Why Does Hibernate Require No Argument Constructor
Executing a Java Application in a Separate Process
Date and Time Conversion to Some Other Timezone in Java
How to Hash Some String with Sha256 in Java
How to Sort a List Alphabetically
How to Log SQL Statements in Spring Boot
Relationship Between Hashcode and Equals Method in Java
Pkix Path Building Failed: Unable to Find Valid Certification Path to Requested Target