I want to load an XML into my java program from my classpath using a URL.
URL resource = MyClass.class.getResource("test.xml");
File file = Paths.get(resource.toURI()).toFile();
The catch is that I want to be able to do this without giving the full path to the xml file. How can I properly add the XML to my classpath to test this. I thought I added it correctly as an external folder but I'm getting a null pointer exception indicating that it was not added properly or that I can't actually search for it.