This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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: 1447


\ 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: 10167

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
wood burning stoves
subject: need help with exception
Similar Threads
filenotfound Exception encountered,kindly help
help with textarea insertion
Delete files in a directory
problem in rediredtin GUI to IO Streams
AWT FlowLayout to BorderLayout