I have managed to compare the jar files and all my images are in both. However, the later jar file includes all sorts of extraneous files which are in the project but not referenced by any of my java source files. the listing includes separate lines for the directory name too.

Judi R


On 17/09/2019 16:25, Thomas Wolf wrote:
The java development kit comes with the 'jar' command (the example of how to do it uses that; on Unix machines the "diff" command lets you view differences between two files).  from a command-prompt, you would type "jar tf theNameOfYourWorkingJarFile" to see a listing of all the classes in that jar file.

Hope that helps,
Tom

On Tue, Sep 17, 2019 at 11:20 AM Judi Rastall <j...@rastall.com <mailto:j...@rastall.com>> wrote:

    Tom,

    How do I look at the contents of a jar file? Is there a jar file
    viewer or decompiler?

    Judi

    On 17/09/2019 16:03, Thomas Wolf wrote:
    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
    <mailto: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 <mailto:tjw...@gmail.com>
    http://landofwolf.blogspot.com/



--
tjw...@gmail.com <mailto:tjw...@gmail.com>
http://landofwolf.blogspot.com/

Reply via email to