java - Getting a List of files from a class path entry -
i facing problem in application cannot list resource class path entry.
enumeration<url> resources = thread.currentthread().getcontextclassloader().getresources("src/main/resources/*.*"); system.out.println(resources); while (resources.hasmoreelements()) { url url = resources.nextelement(); //here getting empty url list.please help. system.out.println(url); }
the couple of problems:
src/main/resources/*.*not valid syntaxclassloader.getresources()- the path must full path, e.g.
src/main/resources
- the path must full path, e.g.
- why trying load classes
src/main/resourcesdirectory?- it assumes resources in such directory, work development purposes
- after compilation resources stored in different directory (maven put top level directory default) , program not work correctly
Comments
Post a Comment