I've been recently working on my AP Comp. Science final project, and I've hit a bit of a snag. My project is a simple UI that displays information about fictional space battleships. I am using the NetBeans IDE JFrame builder to make my UI. Everything works great in the IDE, and the project runs well, and I've pretty much completed it!
My issue comes up when I try to use the .jar file of the project(I have to distribute it to my teacher). I cannot get it to run. Along with that, I cannot clean and build the project in NetBeans. Any attempt at a "clean and build" results to this-
C:\Users\Justyna Koc\Documents\NetBeansProjects\UNCNDatabase\nbproject\build-impl.xml:1387: Unable to delete file C:\Users\Justyna Koc\Documents\NetBeansProjects\UNCNDatabase\dist\UNCNDatabase.jar
Here are my two theories(after what I've read online) as to why it might not be working.
Theory 1- I tried opening the .jar on my Macbook, and after checking the console I noticed that there was a NullPointer referring to this line of code-
unsfRoster.add(new WarVehicle(new ImageIcon(getClass().getResource("/UNSFDataPics/Ivan.jpg")), ...other parameters);
From my analysis, it apperently cannot read the location of the imageicon? The image is exactly where it is specified in this code. I've looked up many ways of getting the image using "getClass()" and "getResource" but I'm not sure where to go from there.
Theory 2- I somehow messed something up in Netbeans that maybe I wasn't aware of before? The only files I have ever edited was the main class file of the project. When I run the project in the IDE, everything works great and I get no errors.
I'm not sure where to go from here in terms of what to do. I do believe that the fact I cannot clean and build, and run the .jar file are somehow tied to one another.