I have spent two days trying to get this to work. J: is a mapped network drive.
import java.io.File;
File file = new File("J:\\data\\newpasload\\savedir\\");
File[] attachedFiles=file.listFiles();
if (attachedFiles==null) {
System.out.println("Failed to read j: drive");
} else {
System.out.println("Number of files = "+attachedFiles.length);
}
The executable jar file works fine when run directly, showing me the number of files in the directory. However I want the executable jar file to run as a scheduled task. When I run it as such the attachedFiles becomes null.