title: Java - hibernate.cfg.xml File Not Found
body: <p>I have my <code>hibernate.cfg.xml</code> located at <code>src/main/resources/</code> but I keep getting this error when I run my maven project, I have also tried putting the path to the file in the configuration like this but still got the error</p>
  
  <pre><code>Configuration conf = new Configuration();  
  conf.configure("/src/main/resources/hibernate.cfg.xml"); 
  </code></pre>
  
  <p>What am I doing wrong? </p>
  
  <p>And when I go to the properties of the project and go to Source I see /src/main/resources in the build path?</p>
  
  <p>It also runs when I make it in eclipse, but when I export to jar it stops working but I have it in class path as you can see<a href="https://i.stack.imgur.com/aJX5o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aJX5o.png" alt="enter image description here"></a></p>
  
  <p>Thanks</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Here is my directory in my eclipse project</p>
  
  <p><a href="https://i.stack.imgur.com/IrNMz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IrNMz.png" alt="enter image description here"></a></p>
  
  <p>And then here is it when I open the .jar file </p>
  
  <p><a href="https://i.stack.imgur.com/Rmn6v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rmn6v.png" alt="enter image description here"></a></p>
  
  <p>Are you saying the .xml should be in the root directory?</p>