title: java setting font in jar file
body: <p>I'm trying to set a font "bilboregular.ttf" found in the resources folder under the root of the jar file. If i run from netbeans the font is set successfully, however if from the jar file it isn't</p>
  
  <p>CODE:</p>
  
  <pre><code>main method:{
  
          String s = System.getProperty("user.dir") + "\\src\\resources\\" + "bilboregular.ttf";
          File a = new File(s);
          if (a.exists()) {
              this.loadFont(s);
          } else {
              this.loadFont(this.getClass().getResource("/resources/" + "bilboregular.ttf").getFile());
          }
  }
  
   public void loadFont(String s) {
      try {
          font = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, new File(s));
          font = font.deriveFont(Font.PLAIN, 20);
          GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
          ge.registerFont(font);
          setFonts();
      } catch (Exception ex) {
      }
  
  }
  
  public boolean setFonts() {
      jLabel3.setFont(font);
      jLabel4.setFont(font);
      return true;
  }
  </code></pre>