images/Graph.png
is not a valid URL for an image located in your jar. Hence, I guess that img
is null on your second try.
I suggest you this way :
//Get the URL with method class.getResource("/path/to/image.png")
URL url = System.class.getResource("/images/Graph.png");
//Use it to get the image
Image img = Toolkit.getDefaultToolkit().getImage(url);
final TrayIcon trayIcon = new TrayIcon(img, "Application Name", popup);
You shall also ensure that images/
is in your classpath.