Ignore directories when listing files
Wrap java functions to a local function