I've looked again at the messages I get when building and I am wondering
is y directory structure is confusing the compiler. This is the message
stream:
ant -f E:\\Judith\\NetBeansProjects\\WagonFlow5
-Dnb.internal.action.name=rebuild clean jar
init:
deps-clean:
Updating property file:
E:\Judith\NetBeansProjects\WagonFlow5\build\built-clean.properties
Deleting directory E:\Judith\NetBeansProjects\WagonFlow5\build
clean:
init:
deps-jar:
Created dir: E:\Judith\NetBeansProjects\WagonFlow5\build
Updating property file:
E:\Judith\NetBeansProjects\WagonFlow5\build\built-jar.properties
Created dir: E:\Judith\NetBeansProjects\WagonFlow5\build\classes
Created dir: E:\Judith\NetBeansProjects\WagonFlow5\build\empty
Created dir:
E:\Judith\NetBeansProjects\WagonFlow5\build\generated-sources\ap-source-output
Compiling 8 source files to
E:\Judith\NetBeansProjects\WagonFlow5\build\classes
Copying 40 files to E:\Judith\NetBeansProjects\WagonFlow5\build\classes
compile:
Created dir: E:\Judith\NetBeansProjects\WagonFlow5\dist
Created dir: E:\Judith\NetBeansProjects\WagonFlow5\build\classes\META-INF
Copying 1 file to
E:\Judith\NetBeansProjects\WagonFlow5\build\classes\META-INF
Nothing to copy.
Building jar: E:\Judith\NetBeansProjects\WagonFlow5\dist\WagonFlow5.jar
To run this application from the command line without Ant, try:
java -jar "E:\Judith\NetBeansProjects\WagonFlow5\dist\WagonFlow5.jar"
deploy:
jar:
BUILD SUCCESSFUL (total time: 1 second)
My source files are in:
E:\Judith\NetBeansProjects\WagonFlow5\src\wagonflow5\
With my images in:
E:\Judith\NetBeansProjects\WagonFlow5\src\wagonflow5\images\
It's several months since I started on this and I can't remember exactly
how I set the project up. I do believe that Netbeans automatically
creates a "src" directory when starting a new project. But I'm puzzled
at having "wagonflow5" at two levels.
Judi R
On 17/09/2019 14:59, Judi Rastall 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