Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URL API to download the file: FileNotfoundException  RSS feed

 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I'm using the URL class from java to download the local file. Code goes as below:



While executing the code, "fileNotFoundException" is being thrown, though the file is present at the specified loaction. Can anybody please see anything wrong in this program? Any help will be most appreciated. Thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File URLs generally start with "file:///".
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you posted does not compile. Please Post Real Code. The reason this is problematic is because when I correct the compilation errors, "our" code works (WinXP, JDK 1.5.0_06-b05):



It would also be useful to see the exception stack trace (Tell The Details).
[ August 06, 2007: Message edited by: Joe Ess ]
 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The real code is as below:



I tried this code on different m'c than earlier one & it worked.
Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!