• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to override a file in another path?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the program:
File sourceFile1 = new File(ls_tempImage1);
File destFile1 = new File(destFileUrl1);
fileLength1 = sourceFile1.length();
FileInputStream fis1 =null;
FileOutputStream fos1 =null ;
try {
fis1 = new FileInputStream(sourceFile1);
fos1 = new FileOutputStream(destFile1.getAbsolutePath(),false);
}
catch(FileNotFoundException fnfe) {}
finally {
try {

for (i=1;i<=fileLength1;i++){
fos1.write(fis1.read());
}
fis1.close();
fos1.close();
} catch(IOException ioe) {
System.err.println("File Closing error: " + ioe);
}
}
and the problem is :
java.lang.NullPointerException
at eating_corp.EatingCorp.updateEatingCorp(EatingCorp.java:642)
at eating_corp.EatingCorpServlet.doPost(EatingCorpServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:82)
at com.caucho.server.http.Invocation.service(Invocation.java:259)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:146)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:238)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157)
at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java:484)
why?
i don't know,How to make it right?
please help me ,thanks !
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at "JavaRanch Naming Policy" . We require names to have at least two words (not just letters), separated by a space, and strongly recommend that you use your full real name. We want to get to know you as a Professional. Please choose a new name which meets the requirements and re-register.
Also this question is more appropriate to the I/O forum, so I will move it there.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic