User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 428,470 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,119 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting

Loading images from executable jar file?

Join Date: May 2008
Posts: 44
Reputation: TheWhite is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
TheWhite TheWhite is offline Offline
Light Poster

Re: Loading images from executable jar file?

  #6  
May 7th, 2008
I did this:
ImageIcon flagIcon = new ImageIcon(getClass().getResource("images/flag2.gif"));

and when I go to run my program in eclipse, I get java.lang.NullPointerException... I compiled the executable jar file anyway, and now it doesn't run...

I went back to check that I compiled the jar file correctly with all the image files and I'm sure I did.. It's root contains: images/*.gif META-INF/*.mf *.class

I also verified my MAIN-CLASS and it is is one of the the *.class files in the root...

What's going on here?



EDIT:
I tried exporting the .jar through Eclipse this time instead of using the afs system at my school and it gave me this error:

JAR creation failed. See details for additional information.
Exported with compile warnings: /minesweeper/src/MineSweeper.java
Resource is out of sync with the file system: '/minesweeper/images/flag2.GIF'.
Resource is out of sync with the file system: '/minesweeper/images/mine.GIF'.
Resource is out of sync with the file system: '/minesweeper/images/qmark.GIF'.

Yes, I'm still finishing up that minesweeper game
Last edited by TheWhite : May 7th, 2008 at 2:11 pm. Reason: new information
Reply With Quote  
All times are GMT -4. The time now is 9:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC