title: Accessing gradle resources from Java
body: <p>I have a gradle-based java project with this structure</p>
  
  <pre><code>.
  ├── myproject
  │      ├── src
  │      |    └── main
  │      |         ├── java
  │      |         └── resources
  │      |               └── myresource.xml
  |      ├── build
  |      |     ├── classes
  |      |     |    └── main
  │      |     |         └── myresource.xml
  |      |     ├── resources
  </code></pre>
  
  <p>I'm trying to access some files in the <em>resources</em> folder using a ClassLoader, like this</p>
  
  <pre><code>ClassLoader.getSystemClassLoader().getResoure("/myresource.xml");
  </code></pre>
  
  <p>but it does not find the file.</p>
  
  <p>The only way I have found to access those files is by exploring the known structure of the project</p>
  
  <pre><code>Path resourcesPath= FileSystems.getDefault().getPath(System.getProperty("user.dir"), "/src/main/resources/");
  </code></pre>
  
  <p>Any idea on what am I doing wrong?</p>