File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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
Rancher

Joined: Jan 08, 2009
Posts: 1449
    
    6

C:\neha\files

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

C:\\neha\\files

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

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



Swastik
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10170
    
    8

Neha,
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: http://aspose.com/file-tools
 
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