Creating lstlistings for Java files in multiple Java folders
to me it stroke odd that you use old java.io classes to list files, while using the newer (not-so-new-anymore) java 7 java.nio classes to determine file type.
I say you should use Files.isDirectory(Path p) and Files.newDirectoryStream(Path p) to check and list files in directory.

Furthermore, if you want to traverse a directory tree, you have the wonderful Files.walkFileTree() that does all the traversing for you.  You need to implement a FileVisitor that has interception points for start and end of directory and of course for visiting a file.  I believe this can help you in detecting src directories.