• Post Reply Bookmark Topic Watch Topic
  • New Topic

Gettting Error!!

 
hemant chaudhary
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using following code to transfer one file to other system:

Getting Error:

java.lang.NullPointerException
at FtpToServer.putFile(FtpToServer.java:127)
at FtpToServer.main(FtpToServer.java:149)
Error in FTP: java.lang.NullPointerException

Can anybody tell me my mistake

JCE: Please use Code Tags
[ April 29, 2008: Message edited by: Joe Ess ]
 
hemant chaudhary
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Joe: sorry for that.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by hemant chaudhary:
@Joe: sorry for that.


It's not a big deal.
So which line is 127 in your code? What can possibly be null on that line? Why don't you print out those values and make sure they exist?
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One other note: listen to your compiler warnings. Don't use the sun internal classes. Use a 3rd party library instead, like Apache Commons Net.
 
kathirvel Natesan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
call the constructor by passing the values before the line

OutputStream out = m_client.put(sbFileNameToSend.substring(sbFileNameToSend.lastIndexOf("\\") + 1));



like

m_client=new FtpToServer(StringBuffer dCSVFile, StringBuffer rCSVFIle);

this will connect to the ftp site first
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!