aspose file tools*
The moose likes Beginning Java and the fly likes NullPointerException at StringTokenizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NullPointerException at StringTokenizer" Watch "NullPointerException at StringTokenizer" New topic
Author

NullPointerException at StringTokenizer

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear friends,

The following code gives me a problem.



I am passing two command-line arguments. First arg is an input file name with full path. Second arg is an output folder with full path.
Example first arg: C:\Program Files\MyFolder\Test.txt
Example second arg: C:\Program Files\MyFolder\Output

When i run the code using

java "C:\Program Files\MyFolder\Test.txt" "C:\Program Files\MyFolder\Output"

the above code gives me a NullPointerException at [// 1].

I am checking while(in.readLine() != null) when the end of file is reached. But still its by-passing the condition and executes the while loop.

Following is the stack trace:



Kindly provide your valuable help.

Thanks,
Vijay


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16


You are reading two lines here. Is this what you intend to do ?


[My Blog]
All roads lead to JavaRanch
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Thats not what i intended.

Silly bad mistake.


Thank you very much for pointing it out.

Regards,
Vijay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException at StringTokenizer
 
Similar Threads
exercise getServiceByName
extract data from .csv
Problem inputting and outputting strings correctly (weird error)
Array question
doubt about string replacement