title: JAVA: Writing a textfile in classpath?
body: <p>i want to write a file in the directory, where my main.class also is.
  This always gets an error:</p>
  
  <pre><code>File file = new File(main.class.getResourceAsStream("test.txt"));
  </code></pre>
  
  <p>That isn't working too:</p>
  
  <pre><code>File file = new File(getClass().getResource(AsStream)("me.test.test.txt"));
  </code></pre>
  
  <p>It always says, that The constructor File(InputStream) is undefined.
  Anyone an idea?</p>
  
  <p>Regards,</p>