This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman 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 Elasticsearch in Action this week in the Big Data 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: 1480


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

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