We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › NullPointerException
Page Index Toggle Pages: 1
NullPointerException (Read 350 times)
NullPointerException
Mar 11th, 2009, 10:41am
 
st newsheet;
void setup()
{
 size(1024,768,P3D);
 newsheet=new st("s.JPG");
}

void draw()
{
 newsheet.paint();
}

class st
{
 PImage graph;
 st(String filePath)
 {
   graph = loadImage(filePath);
 }  
 void paint()
 {
   image(graph,0,0);
 }
}

help to debug!
Re: NullPointerException
Reply #1 - Mar 11th, 2009, 1:37pm
 
Seems correct.
Is s.JPG in the data folder? (ie. is the NPE the only error you have?)
If not on Windows, ensure it has exactly the same case.
Where do you have the NPE? Can you show the stack trace?
Re: NullPointerException
Reply #2 - Mar 12th, 2009, 2:14am
 
Thank you!
After another test I find it my carelessness to not put the JPG file in the data folder...Smiley
Thank you for your attention!谢谢!
Page Index Toggle Pages: 1