You can solve the problem using File class from java.io package.
It works with all kinds of paths. It has methods to find out if you
are dealing with a file or directory. getAbsolutePath(path) gets
the absolute path, current path using getPath() and list() gets the
directory listing.