exception - java.io.FileNotFoundException -



exception - java.io.FileNotFoundException -

i trying web scrape info can utilize in application.

the site trying info off yahoo getting filenotfoundexception when it's trying stream info in.

i have set ip address , port explicitly.

would thankful if can tell me going wrong.

i have posted sample code well.

parenturl = "http://www.yahoo.com"; pageurl = new url(parenturl); system.out.println(parenturl); seek { in = new bufferedreader(new inputstreamreader(pageurl.openstream())); } catch(exception ex2) { ex2.printstacktrace(); } while ((inputline = in.readline()) != null) { out.write(inputline); in.close(); } out.close();

the problem in initialization of out. haven't shown code, like:

outputstream out = new fileoutputstream("non/existent/path/somefilename");

it's due using relative path, help debug it, recommend alter to:

file file = new file("non/existent/path/somefilename"); system.out.println(file.getabsolutepath()); // start simple debugging outputstream out = new fileoutputstream(file);

my guess path of file not think is.

java exception

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -