I am working in a Parser. The problem relies in opening a directory to scan the files in it. In my first project, the code works fine. But when I try to run the exact same code in a frame project the code stops working.
It's awfully stringe since it worked last night, but now it stopped working once more.
// This is the one not working
File actual;
actual = new File("C:\\Users\\kalio\\Pictures\\JavaDocs");
System.out.println("==============================");
System.out.println(actual.getPath());
System.out.println(actual.isDirectory());
System.out.println("==============================");
for( File f : actual.listFiles()){}
// This is the working one
File actual;
actual = new File("C:\\Users\\kalio\\Pictures\\JavaDocs");
System.out.println("==============================");
System.out.println(actual.getPath());
System.out.println(actual.isDirectory());
System.out.println("==============================");
for( File f : actual.listFiles()){}
// this is the output of the not working one
==============================
C:\Users\kalio\Pictures\JavaDocs
false
==============================
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at parser.frmMenu$Scan.<init>(frmMenu.java:273)
at parser.frmMenu.btnSearchActionPerformed(frmMenu.java:256)
at parser.frmMenu.access$000(frmMenu.java:19)
// this is the result of the working one
==============================
C:\Users\kalio\Pictures\JavaDocs
true
==============================