title: Changing Desktop Icon for Java Application
body: <p>I wish to thank you in advance for taking the time to read my question, and I would greatly appreciate any comments, answers, insights, techniques and critiques that you may be able to provide.</p>
  
  <p>I'm looking for a useful method for changing the desktop icon for a Java application. I've looked into this for a few days now, but am not finding an accurate result. </p>
  
  <p>Before you mark this down and call it a duplicate, I have read: <a href="https://stackoverflow.com/questions/209812/how-do-i-change-the-default-application-icon-in-java(recommended">How do I change the default application icon in Java?</a> to others who asked this question), but this does not address my specific problem. I know that their method utilizes a url location instead of an import, but I am trying to learn how to use this with the import(if that is, in fact, possible). When I attempt to use their method for changing by source location. Besides that, the url example doesn't seem to work for a file stored on the computer. I get an "uncaught error" message when I attempt to run it.</p>
  
  <p>I use the following format to declare an image that I have imported into NetBeans:</p>
  
  <pre><code>Image image = new ImageIcon("imported.png").getImage();
  frame.setIconImage(image);
  </code></pre>
  
  <p>Now this works fine for the icon that displays in the toolbar and it also appears in the upper left-hand corner of the frame, but I still have the Java coffee-cup as the icon for the application when I clean and build it.</p>
  
  <p>For additional resources to the code that I am using to attempt this:</p>
  
  <pre><code>import java.awt.Image;
  import javax.swing.*;
  
  public class Check {
      JFrame frame;
      public static void main(String[] args) {
          new Check().go();
      }
      private void go() {
          frame = new JFrame("Test");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          Image image = new ImageIcon("owl.gif").getImage();
  
          frame.setIconImage(image);
          frame.setVisible(true);
          frame.setSize(300, 300);
      }
  }
  </code></pre>
  
  <p>The "owl.gif" bit is what I imported into NetBeans by click and drag method (as described in one of the books that I read that focused on NetBeans).</p>
  
  <p>I'm looking for a way to make a file that I already have saved on my computer the desktop icon for my application after it is built.</p>