I have been doing some digging around and the first line where an image is called is the line identified as giving the error. However, this is part of the code generated by Netbeans when I created the panel using the design feature in Netbeans. In other words, I cannot alter it! Netbeans knows best!

I thought that using the built-in design tools would be quicker and easier but that approach has been my undoing. So yes, I do blame Netbeans for my difficulties.

I have made a start on rewriting everything from scratch. This is not helped by the many different ways in which different folk suggest the calls should be done. Neil's suggestion of Googling loading icons was helpful but did throw up several discussion threads where others were having similar difficulties. It seems that every tutorial I have found gives a different construction. The only thing that is keeping me going on trying to learn Java at all is the goal of "write & compile once, run anywhere".

Judi

On 09/03/2020 18:14, Neil C Smith wrote:
On Mon, 9 Mar 2020 at 17:58, Judi Rastall <j...@rastall.com> wrote:
Trying to run from the CMD prompt, I see this error message:
Exception in thread "main" java.lang.NullPointerException
         at javax.swing.ImageIcon.<init>(Unknown Source)
...
Why will a program that runs perfectly well within the IDE fail to run when 
compiles?
Quite easily!  My guess is the way you're passing the icon location
into ImageIcon. You may want to Google on loading icons bundling in
JARs - you'll find lots of info.  Loading resources from inside a JAR
is (can be) different to loading from the filesystem.

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Reply via email to