title: How to load a properties file from the root directory?
body: <p>I am currently loading a properties file like this:</p>
  
  <pre><code>private Properties loadProperties(String filename) throws IOException{
          InputStream in = ClassLoader.getSystemResourceAsStream(filename);
          if (in == null) {
              throw new FileNotFoundException(filename + " file not found");
          }
          Properties props = new Properties();
          props.load(in);
          in.close();
          return props;
      }
  </code></pre>
  
  <p>However, at the moment my file lays at the scr\user.properties path.</p>
  
  <p>But when I want to write to a properties file:</p>
  
  <pre><code>properties.setProperty(username, decryptMD5(password));
          try {
              properties.store(new FileOutputStream("user.properties"), null);
              System.out.println("Wrote to propteries file!" + username + " " + password);
  </code></pre>
  
  <p>That piece of code generates me a new file at the root folder level of my project.</p>
  
  <p>BUT I want to have one file to write\read. </p>
  
  <p>Therefore how to do that?</p>
  
  <p>PS.: When I want to specify the path I get "Not allowed to modify the file..."</p>