Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ctt.client; import com.ctt.communication.Producer; import com.ctt.communication.SFTPHandler; import com.ctt.infrastructure.FilesMonitor; import java.io.File; import java.io.FileReader; import java.util.Properties; import org.apache.commons.io.monitor.FileAlterationMonitor; import org.apache.commons.io.monitor.FileAlterationObserver; /** * * @author aleji_000 */ public class Client { public static Properties prop; public static void main(String[] args) throws Exception { Client.prop = new Properties(); FileReader reader = new FileReader("../config.properties"); Client.prop.load(reader); String directory = Client.prop.getProperty("directory"); FilesMonitor listener = new FilesMonitor(); File folder = new File(directory); try { FileAlterationObserver observer = new FileAlterationObserver(directory); FileAlterationMonitor monitor = new FileAlterationMonitor(1000); observer.addListener(listener); monitor.addObserver(observer); monitor.start(); } catch (Exception io) { } } }