title: Custom Fonts in Java - getResourceAsStream not working in IntelliJ IDEA but DOES work in JAR
body: <p>I'm trying to package my Java application so that other people can run it. I have no experience with this as I've always dealt with the applications through the IDE. I'm using a custom font and I use the code</p>
  
  <pre><code> vectorFont = Font.createFont(Font.TRUETYPE_FONT, new File("Vectorb.ttf"));
  </code></pre>
  
  <p>which does not work because in the JAR, the "filesystem" does not exist, or so I've been told. So I was suggested to replace <code>new File()</code> with <code>getClass().getResourceAsStream("Vectorb.ttf")</code> which works totally fine after I publish and run the JAR, but if I try to build and run the same code in IntelliJ, it throws an exception <code>"Problem reading font data."</code> I have also tried adding <code>getClass().getClassLoader()</code> to no avail. </p>
  
  <p>Please, what is the issue here, and how do I fix it? This is IntelliJ Community edition.</p>