Here you can find the source of isSymlink(File file)
public static boolean isSymlink(File file) throws IOException
//package com.java2s; /******************************************************************************* * * Copyright (c) 2004-2011 Oracle Corporation. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: /* w w w .ja v a2 s. com*/ * * Kohsuke Kawaguchi, Winston Prakash * * *******************************************************************************/ import java.io.File; import java.io.IOException; public class Main { /** * Checks if the given file represents a symlink. */ public static boolean isSymlink(File file) throws IOException { String name = file.getName(); if (name.equals(".") || name.equals("..")) { return false; } File fileInCanonicalParent; File parentDir = file.getParentFile(); if (parentDir == null) { fileInCanonicalParent = file; } else { fileInCanonicalParent = new File(parentDir.getCanonicalPath(), name); } return !fileInCanonicalParent.getCanonicalFile().equals(fileInCanonicalParent.getAbsoluteFile()); } }