everybody.

I am novice in Java and making training project with UI.
In process of trainings I decided to load icons from resources and to move its loading in the different class.
And got problem.
I really tried to find answers by myself but could not.Code bellow.

Main class

```
package scv.paul;
…
 /**
 * Create the application.
 */
public TestApp() {
    Logger.getLogger(loggerName).fine("Showing main window");
    initialize();       
}

/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frame = new JFrame();
    frame.setTitle("Test App");
    **frame.setIconImage( MyImages.appIcn.getImage());**//here try to load icon

```

And get exception:

*Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError*

Utility class

```
package scv.paul;*
import javax.swing.ImageIcon;

public class MyImages { 
public static final ImageIcon appIcn =  new ImageIcon ( MyImages.class.getResource ( "AppIcon.png" ) );
public static final ImageIcon BtnIcn =  new ImageIcon ( MyImages.class.getResource ( "OK.png" ) );
public static final ImageIcon exitIcn =  new ImageIcon ( MyImages.class.getResource ( "door.png" ) ); 
}

```

Images lay in "\bin" folder

I understand that the problem in the initialization of the static fields. But can’t understand reason.

I got this error if I call even such static field

```
public static final String imgPath = System.getProperties().getProperty("user.dir")+"\\img\\";

```

But I have no errors if I call in main class this static field

```
    public static final String imgPath = "c://myProjectPath//bin";

```

And I could not find how to work with resources in good stile. Where I could read it?