What is the proper use of the new Java 7 Path class?

I am currently using this approach to upload files to my applications:

Path path = Paths.get(ClassLoader.class.getResource(fileName).toURI()); 

where fileName is structured as "/package1/package2/folder/file.lol".

Are there any better, simpler, or more correct methods for getting a Path object? I also need to work in the JAR.

+4
source share
1 answer

If you want to access a file that is not in the bank, then there are better solutions. But since it seems that you want to access this, this is part of the flask, I would say no!

0
source

Source: https://habr.com/ru/post/1416126/


All Articles