|
Hi Rajesh , I've copied your program and run it on my system fine. The proxy stuff makes no difference. Your trying to create the file '/test/slashdot.xml' and it's telling you something is missing (file not found. Make sure the directory /test exists. Did you step through this is a debugger? You'd see that the url read works ok and you would see the line it failed on, i.e. that the write fails and you could then think about why the write fails. Regards Mike --- "Anand, Rajesh" <Rajesh_Anand@xxxxxx> wrote: > Hi Magne, > > The CRUNCH Question is WHY IT WORKS ON YOUR ISERIES > AND NOT > MINE????? > > IS it because the PROXY server is blocking it and I > don't know > how & why? > > But I have already bypassed the proxy server or at > least that's > what the code does I believe. > > WHY IT IS NOT WORKING????? > > Rgds, > > Rajesh Anand > Email:Rajesh_anand@xxxxxx > > > -----Original Message----- > From: java400-l-bounces@xxxxxxxxxxxx > [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of > Magne Kofoed > Sent: 04 January 2005 15:22 > To: Java Programming on and around the iSeries / > AS400 > Subject: Re: Java Error > > > Hi Rajesh, > > i took away the proxy setting in your program, > compiled and > tested. It worked on my iSeries (with JDK 1.4). > > Here is the src code and run statement: > >javac Fsa.java > > $ > > > > java -Djava.version=1.4 -classpath .: Fsa > http://www.slashdot.org/slashdot.xml . slashdot.xml > Everything fine so far > Destination: . > > $ > > > > 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); > } > } > } > > > Rgds, > Magne > > > > > 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 === message truncated === ___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
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.