I currently use this approach to load files in my applications:
Path path = Paths.get(ClassLoader.class.getResource(fileName).toURI());
where fileName is structured as “/package1/package2/folder/file.lol”.
Are there better, simpler, or more correct methods to get a Path object?
I need that works inside JARs too.
If you want to access a file which is not in a jar, then there is better solutions. But since it seems that you want to access that is part of a jar, I would say no!