You need to install a file filter , which you can do by extending FileFilter or using a built-in implementation like FileNameExtensionFilter . Note that FNEF accepts variable arguments in Java, which means it takes an array in the actual JVM bytecode. So something like
(FileNameExtensionFilter. "Text files only" (into-array ["txt"]))
will be a simple, reasonable filter.
Or, if you prefer to do something more specialized, for example, only accept extensions that have J, you can implement filtering yourself. Unfortunately, Java chose to make this a 100% abstract class instead of an interface, so you cannot use reify. In an ideal world you can write
(reify java.io.FileFilter (getDescription [this] "Java loves Js!") (accept [this f] (boolean (re-find #"\..*j[^.]*$" (.getName f)))))
but Java loves classes, so instead you need to
(proxy [java.io.FileFilter] [] (getDescription [] "Java loves Js!") (accept [f] (boolean (re-find #"\..*j[^.]*$" (.getName f)))))
source share