|
Hi Folks, I've a simple program that is meant to read a xml file from a website but I get an error. My program is like so.... import java.net.*; import java.io.*; public class Fsa { public static void main(String[] args) throws Exception { if(args.length < 3){ System.out.println("Error !"); System.out.println("Pls input <url> <path> <filename>"); return; } String test = args[0]; String path = args[1]; String filename = args[2]; String inputLine; // System.getProperties().put( "proxySet", "true" ); System.getProperties().put( "proxyHost", "proxy.ml.com" ); System.getProperties().put( "proxyPort", "8083" ); URL fsa = new URL(test); BufferedReader in = new BufferedReader(new InputStreamReader(fsa.openStream())); System.out.println("Everything fine so far"); File outputfile = new File(path, filename); System.out.println("Destination: " + path); try{ PrintWriter outfilestream = new PrintWriter(new FileOutputStream(outputfile)); while((inputLine = in.readLine()) != null) outfilestream.println(inputLine); outfilestream.flush(); outfilestream.close(); in.close(); } catch(IOException e) { System.out.println("Error in creating file"); System.exit(1); } } } When running this program with the following parameters... java -Djava.version=1.2 -classpath .:/test/jt400.jar Fsa http://www.slashdot.org/slashdot.xml /test slashdot.xml I GET THIS ERROR..... java.io.FileNotFoundException: http://www.slashdot.org/slashdot.xml java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94) java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:42) java/io/IOException.<init>(Ljava/lang/String;)V+1 (IOException.java:47) sun/net/www/protocol/http/HttpURLConnection.getInputStream()Ljava/io/Inp utStream;+356 (HttpURLConnection.java:530) java/net/URL.openStream()Ljava/io/InputStream;+4 (URL.java:818) Fsa.main(^Ljava/lang/String;)V+0 (Fsa.java:8) Any help will be greatly appreciated. rgds, Rajesh Anand Merrill Lynch Email:Rajesh_anand@xxxxxx -------------------------------------------------------- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ --------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.