0

I am attempting to make an image show up in my JPanel. This has worked 100% fine when I test in Eclipse, but when I export and run, I get a stack trace.

Here is how I attempt to access the file:

myPicture = ImageIO.read(Window.class.getResource("/images/audiorpglogo.png"));

And here's what I get:

java.lang.IllegalArgumentException: input == null!
    at javax.imageio.ImageIO.read(ImageIO.java:1362)
    at me.pogostick29.audiorpg.window.Window.<init>(Window.java:70)
    at me.pogostick29.audiorpg.window.WindowManager.setup(WindowManager.java:16)
    at me.pogostick29.audiorpg.AudioRPG.main(AudioRPG.java:29)
nrubin29
  • 1,522
  • 5
  • 25
  • 53
  • How do you "export and run" the application? Do you have a jar file that you execute with `java -jar myapp.jar`? Something else? – Andrea Apr 13 '13 at 14:01
  • I export it as a JAR file and run it with `java -jar` – nrubin29 Apr 13 '13 at 14:01
  • 1
    I also similar problems accessing files especially when you make a jar I got great help in SO .. this will help your case too.. http://stackoverflow.com/questions/14209107/read-a-file-kept-in-a-jar-from-java-code-also-present-in-same-jar – AurA Apr 13 '13 at 14:02
  • 2
    Is the `images` folder (and the `audiorpglogo.png` file) present in your JAR file? – mthmulders Apr 13 '13 at 14:17
  • @PogoStick29 it's Ok a previous answer helped you, that's great we try to keep least number of similar questions on StackOverflow. that is why I did not post the same thing as an answer – AurA Apr 14 '13 at 07:14

0 Answers0