Judi,
I would compare the contents of your jar files - the one that works vs. the
one that now doesn't work.  i.e. jar tf workginJarFile.jar > l1; jar tf
nonWorkingJarFile.jar > l2; diff l1 l2.  This might help you see if, for
whatever reason, the images didn't make it into your current jar file.

Good luck.
Tom


On Tue, Sep 17, 2019 at 9:59 AM Judi Rastall <j...@rastall.com> wrote:

> I am working on an application that needs to load various images and there
> seem to be a million different ways to do this in the examples I have found
> online. The method I have found to work most reliably until recently is
> this:
>
> LogoLabel.setIcon(new
> javax.swing.ImageIcon(getClass().getResource("Images/WF5_200.gif")));
>
> This is part of the setting up of a JLabel within a JPanel and it runs
> perfectly well within NetBeans. I thought I was doing quite well and have
> managed to call other functions from JButtons in the main app.
>
> At various times I have built (compiled) the project to a jar file and
> have tested it to see that it runs OK under the runtime engine. So far so
> good. However, in recent weeks the jar file has stopped running. It builds
> with no error messages but if I run it from my desktop shortcut the cursor
> shows "waiting" for a couple of seconds and then reverts to normal and
> nothing else happens. If I run it from the command line within the \dist\
> directory I can see an "Unknown Source" error message followed by a pointer
> to the line of code above that loads the gif file. It appears to me that
> the compile/build function cannot interpret the file location. I have tried
> placing a copy of the image in the same directory as the source java file
> (and removing the images\ path) but still no joy.
>
> Now here's the strange thing. Until the end of August it would build and
> run OK. I was able to retrieve the previous jar file from my backup and it
> still runs perfectly well.
>
> I cannot understand what has changed and would be grateful for any
> suggestions as to where I might look to solve this very frustrating problem.
>
> With thanks,
>
> Judi R
>
>
>
>

-- 
tjw...@gmail.com
http://landofwolf.blogspot.com/

Reply via email to