2
Java JNotify를 사용하여 디렉토리 이벤트를 수신 대기 중입니다.Windows에서 JNotify 구성
가 가 가그러나, 나는 아래의 프로그램을 실행 해요 때마다 프로그램이 오류없이 아무것도 대신
즉시 종료되고 난 프로그램이 이벤트
기다려야한다고 생각import net.contentobjects.jnotify.*;
public class ListenFile
{
public static void main(String [] args) throws JNotifyException
{
String path = "C:/Users/noor/Desktop/Files";
int mask = JNotify.FILE_CREATED |
JNotify.FILE_DELETED |
JNotify.FILE_MODIFIED|
JNotify.FILE_RENAMED;
boolean watchSubtree = true;
int watchID = JNotify.addWatch(path, mask, watchSubtree, new JNotifyListener(){
@Override
public void fileCreated(int arg0, String arg1, String arg2) {
System.out.println("1");
}
@Override
public void fileDeleted(int arg0, String arg1, String arg2) {
// TODO Auto-generated method stub
System.out.println("2");
}
@Override
public void fileModified(int arg0, String arg1, String arg2) {
// TODO Auto-generated method stub
System.out.println("3");
}
@Override
public void fileRenamed(int arg0, String arg1, String arg2,
String arg3) {
// TODO Auto-generated method stub
System.out.println("4");
}});
try
{
Thread.sleep(1000000);
}
catch (InterruptedException e1)
{
}
}
}
프로그램을 추가하는 것을 잊었습니까? –
여기에 프로그램의 일부가 있지만, 이것에 대해서만 jnotify를 시도하고 있습니다 – Noor