m_image is a private java.awt.Image object of the class I'm in and filename is a String argument of the method I'm in. The filename I pass to this method when I call it is the name of a bitmap in the same directory of the .java file. If it matters, I'm using eclipse to run this.
The code gets to point F, and gives me a NullPointerException (or so I think that's the issue, based on my knowledge of Java error output):
which line is line 45? there are only 20 here.
what type of image are you trying to load and store to?
what point is it printing up to? (point a,b,c,d,e,f,g,h)
as an alternative why not use BufferedImage img=ImageIO.read(new File("myFile.jpg")); ?
of course i don't know if this works with resources
The location of the source file has nothing to do with it. Either make sure the file is in the working directory from which you run the program (if you're running from the command line, that's the directory you're in when you launch the program), or specify a complete path.
alright, so apparently eclipse uses the project's root folder as the working directory by default, so I made the path local to that and it worked. Many thanks.
Oh, and I'm making Pong.
edit:
hmm, well actually my original method still doesn't work.... I'll used the other method for now, but any other ideas why the first one doesn't work?
Last edited by CoolGamer48; Dec 15th, 2008 at 12:28 am.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.