|
Thanks I will try this.. Sudha Sudha Ramanujan SunGard Futures Systems sramanujan@xxxxxxxxxxxxxxxxxx (312) 577 6179 (312) 577 6101 - Fax -----Original Message----- From: Magne Kofoed [mailto:magne@xxxxxxxxx] Sent: Monday, December 13, 2004 3:44 PM To: Java Programming on and around the iSeries / AS400 Subject: Re: Qsh - Java call Hi, if you just want to connect to an URL, get the file (pdf, html...) and save it on the iSeries (or whatever system you are running on)....here is some test code that do so: java -Djava.version=1.4 URLReader <url> <path> <file> import java.net.*; import java.io.*; public class URLReader { public static void main(String args []) throws Exception { if (args.length < 3) { System.out.println("Error !"); System.out.println("Usage: URLReader [url] [path] [file]"); return; } String test = args[0]; String path = args[1]; String filename = args[2]; URL yahoo = new URL(test); BufferedReader in = new BufferedReader( new InputStreamReader( yahoo.openStream())); String inputLine; 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 exc){ System.out.println("Error opening file! Does Directory exist?"); System.exit(1); } } } Rgds, Magne Hi all, I have a code that tries to open a browser and URL. I am having problems getting this to work from qsh command line. The code is similar to Ostermiller's Browser() called BrowseControl() and I removed all the package declarations & jar to call from command line (I don't understand why, but it would not find the class from jar when the classpath refers to jar). I get browser not found or cannot be opened error now. >From the code I understand it picks up UNIX_PATH and so I changed the default since I don't have netscape. Java Code: // The default browser under unix. // private static final String UNIX_PATH = "netscape"; // The flag to display a url. private static final String UNIX_PATH = "explorer"; private static final String UNIX_FLAG = "-remote openURL"; I also tried MSIE Call and error: Could not invoke browser, command=MISE -remote openURL(http://www.javaworld.c om) Caught: java.io.IOException: MISE: not found $ > java BrowseControl http://www.yahoo.com Could not invoke browser, command=MISE -remote openURL(http://www.javaworld.c om) Caught: java.io.IOException: MISE: not found $ > java BrowseControl http://www.yahoo.com Could not invoke browser, command=explorer -remote openURL(http://www.javawor ld.com) Caught: java.io.IOException: explorer: not found TIA, Sudha Sudha Ramanujan SunGard Futures Systems sramanujan@xxxxxxxxxxxxxxxxxx (312) 577 6179 (312) 577 6101 - Fax -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
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.