| 
 | 
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 
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 
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.