import java.util.List; /** * * 吴伟 版权所有 */ /** * @author marker * @date 2013-12-2 下午2:57:59 * @version 1.0 * @blog www.yl-blog.com * @weibo http://t.qq.com/wuweiit */ public class Watcher {/* public static void main(String[] args) { Path this_dir = Paths.get("."); System.out.println(this_dir.toAbsolutePath()); System.out.println("Now watching the current directory …"); try { WatchService watcher = this_dir.getFileSystem().newWatchService(); this_dir.register(watcher, StandardWatchEventKinds.ENTRY_CREATE); WatchKey watckKey = watcher.take(); List> events = watckKey.pollEvents(); for (WatchEvent event : events) { System.out.println("Someone just created the file '" + event.context().toString() + "'."); } } catch (Exception e) { System.out.println("Error: " + e.toString()); } }*/ }