aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes AWT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "AWT" Watch "AWT" New topic
Author

AWT

Manoj Syoran
Greenhorn

Joined: Nov 04, 2011
Posts: 7
Sir When I run this code I get a NullPointerException.Please help me in finding the reason for this error in my code.


Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

You need to state exactly where the NPE is happening. Paste in the exactly, complete error message, including the stack trace, and make it clear which line is causing it.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Never do this:

catch(Exception ex)
{
///////////////
}

At the very least print a message to where you will see it. For example, if there's a problem in line 134 or 135, the con or st variables will be null, yet you won't know anything about it.
Manoj Syoran
Greenhorn

Joined: Nov 04, 2011
Posts: 7
Sir I am sending image of exception on the commandline
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4240
    
    7

Something isn't right with that image. Just tell us which line of the code you've posted the error is occurring on (you'll have to convert the file line number it's reporting to you to the line of code that you've posted, if they aren't exactly the same).
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Manoj Syoran wrote:Sir I am sending image of exception on the commandline


PostTextNotScreenshots (<-- It's a link. Click it.)

And of course we can't see your image. Did you notice that it is rooted at your C: drive? You wouldn't expect the entire world to be able to get to your computer just via "C:", would you?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12676
    
    5
You can capture the text in a Command Prompt window as simple text - screen shots are a waste of bandwidth and wont show the entire stack trace.

1. right click on the upper left corner to get a menu
2. pick the Edit -> select all option - selected text will be highlighted
3. press enter - text will be on clipboard

Java Resources at www.wbrogden.com
Manoj Syoran
Greenhorn

Joined: Nov 04, 2011
Posts: 7
Sir, Here is the error code.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Manoj Syoran wrote:

In your actionPerformed method, on line 217, you are adding something that's null to a container. I see only one line that could be the cause, p8.add(lbl[i]);. This would mean that lbl[i] is null, and that can only be the case if your database query returned 0 results.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AWT
 
Similar Threads
Still not working..help please.
menu with hotkeys in applet using AWT only
hotkeys in applets using awt
why
Help please