M
M
mvsavkin2016-12-14 15:09:25
Java
mvsavkin, 2016-12-14 15:09:25

How to properly use to access resources?

I am developing a Java SE application. I use various settings resources located in the standard directory. Those. when accessing a resource, the path is src/main/resources/resources.xml
When assembled with maven, resources are stored in the root.
The question is how to correctly set the path to the resource?
Or just make the same structure when assembling?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-12-14
@mvsavkin

getClassLoader().getResourceAsStream(path);
path - path relative to resources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question