This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes need help with exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help with exception" Watch "need help with exception" New topic

need help with exception

neha gautam
Ranch Hand

Joined: Mar 31, 2009
Posts: 32
hi all, i m gettin a null pointer exception in this, in line 28,43, 56, , but i m not able figure it out please help
code is

thanks to all
Swastik Dey

Joined: Jan 08, 2009
Posts: 1449


\ is an escape character in java, so in this case you need


and same for getFilesInDir("C:\\neha"); in

now even if you specify the correct path its possible that no files exist in the specified in the given directory , so you need to put check before continuing the process

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172

In future, please use code tags.
I have edited your original post to use code tags, and as you can see it makes the code easier to read an understand. It even displays the line numbers !

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
neha gautam
Ranch Hand

Joined: Mar 31, 2009
Posts: 32
got it!!!
thank a ton
neha gautam
Ranch Hand

Joined: Mar 31, 2009
Posts: 32
roger maneesh thanks
I agree. Here's the link:
subject: need help with exception
Similar Threads
AWT FlowLayout to BorderLayout
filenotfound Exception encountered,kindly help
help with textarea insertion
Delete files in a directory
problem in rediredtin GUI to IO Streams